1# #-- dnstap_tls_peername.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
6
7. ../common.sh
8PRE="../.."
9
10# test if the server is up.
11echo "> dig www.example.com."
12dig @127.0.0.1 -p $UNBOUND_PORT www.example.com. | tee outfile
13echo "> check answer"
14if grep "10.20.30.40" outfile; then
15	echo "OK"
16else
17	echo "> cat logfiles"
18	cat tap.log
19	cat tap.errlog
20	cat fwd.log
21	cat unbound.log
22	echo "Not OK"
23	exit 1
24fi
25
26echo "> check tap.log for dnstap info"
27# see if it logged the information in tap.log
28# wait for a moment for filesystem to catch up.
29if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
30if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
31if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
32if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
33if grep "www.example.com" tap.log >/dev/null; then :; else sleep 1; fi
34if grep "www.example.com" tap.log >/dev/null; then :; else sleep 10; fi
35if grep "www.example.com" tap.log; then echo "yes it is in tap.log";
36else
37	echo "information not in tap.log"
38	echo "failed"
39	echo "> cat logfiles"
40	cat tap.log
41	cat tap.errlog
42	cat fwd.log
43	cat unbound.log
44	echo "Not OK"
45	exit 1
46fi
47
48echo "> OK"
49exit 0
50