1 # #-- dnstap_tcp.test --#
2 # source the master var file when it's there
3 [ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
4 # use .tpkg.var.test for in test variable passing
5 [ -f .tpkg.var.test ] && source .tpkg.var.test
9 if grep "define USE_DNSTAP 1" $PRE/config.h; then echo test enabled; else echo test skipped; exit 0; fi
11 # test if the server is up.
12 echo "> dig www.example.com."
13 dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
15 if grep "10.20.30.40" outfile; then
27 echo "> check tap.log for dnstap info"
28 # see if it logged the information in tap.log
29 # wait for a moment for filesystem to catch up.
30 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
31 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
32 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
33 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
34 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
35 if grep "www.example.com" tap.log >/dev/null; then :; else sleep 10; fi
36 if grep "www.example.com" tap.log; then echo "yes it is in tap.log";
38 echo "information not in tap.log"
50 echo "> test disconnect from the upstream server"
52 kill_pid $DNSTAP_SOCKET_PID
53 dig @127.0.0.1 -p $UNBOUND_PORT down.example.net.
55 # bring log socket back up
56 $PRE/unbound-dnstap-socket -s "127.0.0.1@$TAP_PORT" -l -vvvv 2>tap2.errlog >tap2.log &
57 if test $? -ne 0; then
58 echo "could not start (again) unbound-dnstap-socket server"
62 echo "DNSTAP_SOCKET_PID=$DNSTAP_SOCKET_PID" >> .tpkg.var.test
63 # wait for the server to go up
64 wait_server_up "tap2.errlog" "start of service"
66 dig @127.0.0.1 -p $UNBOUND_PORT up.example.net.
68 dig @127.0.0.1 -p $UNBOUND_PORT up2.example.net.
70 for x in down up up2; do
71 if grep "$x.example.net" tap2.log >/dev/null; then :; else sleep 1; fi
72 if grep "$x.example.net" tap2.log >/dev/null; then :; else sleep 1; fi
73 if grep "$x.example.net" tap2.log >/dev/null; then :; else sleep 1; fi
74 if grep "$x.example.net" tap2.log >/dev/null; then :; else sleep 1; fi
75 if grep "$x.example.net" tap2.log >/dev/null; then :; else sleep 1; fi
76 if grep "$x.example.net" tap2.log >/dev/null; then :; else sleep 10; fi
77 if grep "$x.example.net" tap2.log; then echo "yes it is in tap2.log";
79 echo "$x.example.net. information not in tap2.log"
84 echo "> tap2 logfiles"