]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
stream reuse, test timeout and simultaneous queries.
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 22 Jul 2020 13:40:17 +0000 (15:40 +0200)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 22 Jul 2020 13:40:17 +0000 (15:40 +0200)
testdata/tcp_reuse.tdir/tcp_reuse.conf2
testdata/tcp_reuse.tdir/tcp_reuse.test

index 308107094e2c06bd1b6fbcecc15f717aafe4fff9..7bd7c23e3f15b42cfe44f759311838fcac178dad 100644 (file)
@@ -22,6 +22,11 @@ server:
        local-data: "www2.example.com  A 10.20.30.42"
        local-data: "www3.example.com  A 10.20.30.43"
        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-zone: "drop.net" deny
+       local-zone: "refuse.net" refuse
 
 # if queries escape, send them to localhost
 forward-zone:
index 4b006afc429292629508818dc6ebabe0e3ad2e0f..ae8753cdeaf2867d8b1f84dc790994a708ff3632 100644 (file)
@@ -25,12 +25,12 @@ fi
 if grep "www1.example.com" outfile | grep "10.20.30.41"; then
        echo "content OK"
 else
-       echo "result contents not OK"
+       echo "result contents not OK, for www1.example.com"
        echo "> cat logfiles"
        cat outfile
        cat unbound2.log 
        cat unbound.log
-       echo "result contents not OK"
+       echo "result contents not OK, for www1.example.com"
        exit 1
 fi
 echo "OK"
@@ -52,12 +52,180 @@ fi
 if grep "www2.example.com" outfile | grep "10.20.30.42"; then
        echo "content OK"
 else
-       echo "result contents not OK"
+       echo "result contents not OK, for www2.example.com"
        echo "> cat logfiles"
        cat outfile
        cat unbound2.log 
        cat unbound.log
-       echo "result contents not OK"
+       echo "result contents not OK, for www2.example.com"
+       exit 1
+fi
+
+echo "> query drop.net."
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT drop.net. A IN >outfile 2>&1
+cat outfile
+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
+if grep "rcode: SERVFAIL" outfile; then
+       echo "content OK"
+else
+       echo "result contents not OK, for drop.net"
+       echo "> cat logfiles"
+       cat outfile
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for drop.net"
+       exit 1
+fi
+
+echo "> query refuse.net."
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT refuse.net. A IN >outfile 2>&1
+cat outfile
+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
+if grep "rcode: SERVFAIL" outfile; then
+       echo "content OK"
+else
+       echo "result contents not OK, for refuse.net"
+       echo "> cat logfiles"
+       cat outfile
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for refuse.net"
+       exit 1
+fi
+
+echo "> query q1.drop.net."
+echo "> query q2.drop.net."
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT q1.drop.net. A IN >outfile1 2>&1 &
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT q2.drop.net. A IN >outfile2 2>&1 &
+wait
+if test "$?" -ne 0; then
+       echo "exit status not OK"
+       echo "> cat logfiles"
+       cat outfile1
+       cat outfile2
+       cat unbound2.log
+       cat unbound.log
+       echo "Not OK"
+       exit 1
+fi
+cat outfile1
+cat outfile2
+if grep "rcode: SERVFAIL" outfile1; then
+       echo "content OK"
+else
+       echo "result contents not OK, for q1.drop.net"
+       echo "> cat logfiles"
+       cat outfile1
+       cat outfile2
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for q1.drop.net"
+       exit 1
+fi
+if grep "rcode: SERVFAIL" outfile2; then
+       echo "content OK"
+else
+       echo "result contents not OK, for q2.drop.net"
+       echo "> cat logfiles"
+       cat outfile1
+       cat outfile2
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for q2.drop.net"
+       exit 1
+fi
+
+echo "> query www3.example.com."
+echo "> query www4.example.com."
+echo "> query www5.example.com."
+echo "> query www6.example.com."
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www3.example.com. A IN >outfile3 2>&1 &
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www4.example.com. A IN >outfile4 2>&1 &
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www5.example.com. A IN >outfile5 2>&1 &
+$PRE/streamtcp -f 127.0.0.1@$UNBOUND_PORT www6.example.com. A IN >outfile6 2>&1 &
+wait
+if test "$?" -ne 0; then
+       echo "exit status not OK"
+       echo "> cat logfiles"
+       cat outfile3
+       cat outfile4
+       cat outfile5
+       cat outfile6
+       cat unbound2.log
+       cat unbound.log
+       echo "Not OK"
+       exit 1
+fi
+if grep "www3.example.com" outfile3 | grep "10.20.30.43"; then
+       echo "content OK"
+else
+       echo "result contents not OK, for www3.example.com"
+       echo "> cat logfiles"
+       cat outfile3
+       cat outfile4
+       cat outfile5
+       cat outfile6
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for www3.example.com"
+       exit 1
+fi
+if grep "www4.example.com" outfile4 | grep "10.20.30.44"; then
+       echo "content OK"
+else
+       echo "result contents not OK, for www4.example.com"
+       echo "> cat logfiles"
+       cat outfile3
+       cat outfile4
+       cat outfile5
+       cat outfile6
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for www4.example.com"
+       exit 1
+fi
+if grep "www5.example.com" outfile5 | grep "10.20.30.45"; then
+       echo "content OK"
+else
+       echo "result contents not OK, for www5.example.com"
+       echo "> cat logfiles"
+       cat outfile3
+       cat outfile4
+       cat outfile5
+       cat outfile6
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for www5.example.com"
+       exit 1
+fi
+if grep "www6.example.com" outfile6 | grep "10.20.30.46"; then
+       echo "content OK"
+else
+       echo "result contents not OK, for www6.example.com"
+       echo "> cat logfiles"
+       cat outfile3
+       cat outfile4
+       cat outfile5
+       cat outfile6
+       cat unbound2.log
+       cat unbound.log
+       echo "result contents not OK, for www6.example.com"
        exit 1
 fi