xref: /freebsd/contrib/unbound/testdata/log_servfail.tdir/log_servfail.test (revision ee3960cba1068e12fb032a68c46d74841d9edab3)
1# #-- log_servfail.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
6PRE="../.."
7. ../common.sh
8
9outfile=dig.out
10
11teststep "Check if log-servfail logs to output for iterator error"
12dig a.servfail @127.0.0.1 -p $SERVER_PORT > $outfile
13if ! grep "SERVFAIL" $outfile
14then
15	cat $outfile
16	echo "Did not get a SERVFAIL response"
17	exit 1
18fi
19if ! grep "SERVFAIL <a\.servfail\. "  unbound.log
20then
21        echo "No log-servfail in output"
22        exit 1
23fi
24
25teststep "Enable serve expired"
26$PRE/unbound-control -c ub.conf set_option serve-expired: yes
27if test $? -ne 0
28then
29	echo "unbound-control command exited with non-zero error code"
30	exit 1
31fi
32
33teststep "Check if log-servfail logs to output for iterator error (with serve-expired)"
34dig b.servfail @127.0.0.1 -p $SERVER_PORT > $outfile
35if ! grep "SERVFAIL" $outfile
36then
37	cat $outfile
38	echo "Did not get a SERVFAIL response"
39	exit 1
40fi
41if ! grep "SERVFAIL <b\.servfail\. "  unbound.log
42then
43        echo "No log-servfail in output"
44        exit 1
45fi
46
47exit 0
48