summaryrefslogtreecommitdiff
path: root/testdata/log_servfail.tdir/log_servfail.test
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/log_servfail.tdir/log_servfail.test')
-rw-r--r--testdata/log_servfail.tdir/log_servfail.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/testdata/log_servfail.tdir/log_servfail.test b/testdata/log_servfail.tdir/log_servfail.test
new file mode 100644
index 000000000000..1d19e5ca3b22
--- /dev/null
+++ b/testdata/log_servfail.tdir/log_servfail.test
@@ -0,0 +1,47 @@
+# #-- log_servfail.test --#
+# source the master var file when it's there
+[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
+# use .tpkg.var.test for in test variable passing
+[ -f .tpkg.var.test ] && source .tpkg.var.test
+PRE="../.."
+. ../common.sh
+
+outfile=dig.out
+
+teststep "Check if log-servfail logs to output for iterator error"
+dig a.servfail @127.0.0.1 -p $SERVER_PORT > $outfile
+if ! grep "SERVFAIL" $outfile
+then
+ cat $outfile
+ echo "Did not get a SERVFAIL response"
+ exit 1
+fi
+if ! grep "SERVFAIL <a\.servfail\. " unbound.log
+then
+ echo "No log-servfail in output"
+ exit 1
+fi
+
+teststep "Enable serve expired"
+$PRE/unbound-control -c ub.conf set_option serve-expired: yes
+if test $? -ne 0
+then
+ echo "unbound-control command exited with non-zero error code"
+ exit 1
+fi
+
+teststep "Check if log-servfail logs to output for iterator error (with serve-expired)"
+dig b.servfail @127.0.0.1 -p $SERVER_PORT > $outfile
+if ! grep "SERVFAIL" $outfile
+then
+ cat $outfile
+ echo "Did not get a SERVFAIL response"
+ exit 1
+fi
+if ! grep "SERVFAIL <b\.servfail\. " unbound.log
+then
+ echo "No log-servfail in output"
+ exit 1
+fi
+
+exit 0