1# #-- root_zonemd.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
7PRE="../.."
8# do the test
9echo "> dig www.example.com."
10dig @localhost -p $UNBOUND_PORT . SOA | tee outfile
11echo "> check answer"
12if grep root-servers outfile | grep "nstld.verisign-grs.com"; then
13	echo "OK"
14else
15	echo "Not OK"
16	exit 1
17fi
18
19echo "> unbound-control status"
20$PRE/unbound-control -c ub.conf status
21if test $? -ne 0; then
22	echo "wrong exit value."
23	exit 1
24else
25	echo "exit value: OK"
26fi
27
28# This is the output when an unsupported algorithm is used.
29if grep "auth zone . ZONEMD unsupported algorithm" unbound.log; then
30	echo "OK"
31else
32	echo "ZONEMD verification not OK"
33	exit 1
34fi
35
36echo "> unbound-control auth_zone_reload ."
37$PRE/unbound-control -c ub.conf auth_zone_reload . 2>&1 | tee outfile
38if test $? -ne 0; then
39	echo "wrong exit value."
40	exit 1
41fi
42# The output of the reload can be checked.
43#echo "> check unbound-control output"
44#if grep "example.com: ZONEMD verification successful" outfile; then
45	#echo "OK"
46#else
47	#echo "Not OK"
48	#exit 1
49#fi
50
51exit 0
52