xref: /netbsd-src/external/bsd/unbound/dist/testdata/zonemd_reload.tdir/zonemd_reload.test (revision 7a540f2bd4f5b968566c2607d6462c7f2fb452cf)
1# #-- zonemd_reload.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 www.example.com. | tee outfile
11if grep SERVFAIL outfile; then
12	echo "> try again"
13	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
14fi
15if grep SERVFAIL outfile; then
16	echo "> try again"
17	sleep 1
18	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
19fi
20if grep SERVFAIL outfile; then
21	echo "> try again"
22	sleep 1
23	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
24fi
25if grep SERVFAIL outfile; then
26	echo "> try again"
27	sleep 1
28	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
29fi
30if grep SERVFAIL outfile; then
31	echo "> try again"
32	sleep 10
33	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
34fi
35if grep SERVFAIL outfile; then
36	echo "> try again"
37	sleep 10
38	dig @localhost -p $UNBOUND_PORT www.example.com. | tee outfile
39fi
40echo "> cat logfiles"
41cat fwd.log
42cat unbound.log
43echo "> check answer"
44if grep www.example.com outfile | grep "192.0.2.1"; then
45	echo "OK"
46else
47	echo "Not OK"
48	exit 1
49fi
50
51echo "> unbound-control status"
52$PRE/unbound-control -c ub.conf status
53if test $? -ne 0; then
54	echo "wrong exit value."
55	exit 1
56else
57	echo "exit value: OK"
58fi
59
60echo "> unbound-control auth_zone_reload example.com"
61$PRE/unbound-control -c ub.conf auth_zone_reload example.com 2>&1 | tee outfile
62if test $? -ne 0; then
63	echo "wrong exit value."
64	exit 1
65fi
66echo "> check unbound-control output"
67if grep "example.com: ZONEMD verification successful" outfile; then
68	echo "OK"
69else
70	echo "Not OK"
71	exit 1
72fi
73
74exit 0
75