From: W.C.A. Wijngaards Date: Thu, 30 Jul 2020 14:41:28 +0000 (+0200) Subject: stream reuse, add a test for close by upstream server after timeout. X-Git-Tag: release-1.13.0rc1~5^2~21 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=12d880ad47c90aa22b2c6a6becedad0a78e10efc;p=thirdparty%2Funbound.git stream reuse, add a test for close by upstream server after timeout. --- diff --git a/testdata/tcp_reuse.tdir/tcp_reuse.conf2 b/testdata/tcp_reuse.tdir/tcp_reuse.conf2 index 6cb1e6122..55985c83f 100644 --- a/testdata/tcp_reuse.tdir/tcp_reuse.conf2 +++ b/testdata/tcp_reuse.tdir/tcp_reuse.conf2 @@ -10,6 +10,7 @@ server: chroot: "" username: "" do-not-query-localhost: no + tcp-idle-timeout: 10000 log-queries: yes log-replies: yes @@ -24,6 +25,7 @@ server: local-data: "www4.example.com A 10.20.30.44" local-data: "www5.example.com A 10.20.30.45" local-data: "www6.example.com A 10.20.30.46" + local-data: "www7.example.com A 10.20.30.47" local-zone: "drop.net" deny local-zone: "refuse.net" refuse diff --git a/testdata/tcp_reuse.tdir/tcp_reuse.pre b/testdata/tcp_reuse.tdir/tcp_reuse.pre index 30dbdc96f..ada38271a 100644 --- a/testdata/tcp_reuse.tdir/tcp_reuse.pre +++ b/testdata/tcp_reuse.tdir/tcp_reuse.pre @@ -25,7 +25,7 @@ wait_unbound_up unbound.log sed -e 's/@PORT\@/'$UPSTREAM_PORT'/' -e 's/@TOPORT\@/'$UPSTREAM_PORT'/' < tcp_reuse.conf2 > ub2.conf # start upstream unbound in the background #$PRE/unbound -d -c ub2.conf >unbound2.log 2>&1 & -$PRE/unbound -d -c ub2.conf 2>&1 | tee unbound2.log & +valgrind $PRE/unbound -d -c ub2.conf 2>&1 | tee unbound2.log & UPSTREAM_PID=$! echo "UPSTREAM_PID=$UPSTREAM_PID" >> .tpkg.var.test wait_unbound_up unbound2.log diff --git a/testdata/tcp_reuse.tdir/tcp_reuse.test b/testdata/tcp_reuse.tdir/tcp_reuse.test index 5541ed7f9..5f0844890 100644 --- a/testdata/tcp_reuse.tdir/tcp_reuse.test +++ b/testdata/tcp_reuse.tdir/tcp_reuse.test @@ -213,6 +213,36 @@ for x in a1.more.net a2.more.net a3.more.net a4.more.net a5.more.net; do fi done +# make the server timeout to drop the upstream connection +echo "> sleep 20" +sleep 15 +# see if we are still up. +echo "> query a7.more.net" +$PRE/streamtcp -a -f 127.0.0.1@$UNBOUND_PORT a7.more.net A IN >outfile 2>&1 +if test "$?" -ne 0; then + echo "exit status not OK" + echo "> cat logfiles" + cat outfile + cat unbound2.log + cat unbound.log + echo "Not OK" + exit 1 +fi +cat outfile +for x in a7.more.net; do + if grep "$x" outfile | grep "10.20.30.40"; then + echo "content OK for $x" + else + echo "result contents not OK, for $x" + echo "> cat logfiles" + cat outfile + cat unbound2.log + cat unbound.log + echo "result contents not OK, for $x" + exit 1 + fi +done + # dropconn.drop.net make the server drop the connection. echo "> query a11.more.net a12.more.net dropconn.drop.net a14.more.net a15.more.net" $PRE/streamtcp -a -f 127.0.0.1@$UNBOUND_PORT a11.more.net A IN a12.more.net A IN dropconn.drop.net A IN a14.more.net A IN a15.more.net A IN >outfile 2>&1