]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add serve-stale test settings after flush
authorMatthijs Mekking <matthijs@isc.org>
Thu, 24 Aug 2023 09:23:49 +0000 (11:23 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Thu, 31 Aug 2023 09:07:35 +0000 (11:07 +0200)
Add a test case to ensure that after 'rndc flush', the serve-stale
settings are not reset.

bin/tests/system/serve-stale/tests.sh

index c7802873984738f38dee78744d6843a0e49d6b09..aec5f953f5a30bff9e9bc03f946869a1139ef71c 100755 (executable)
@@ -2533,6 +2533,14 @@ rndc_reload ns3 10.53.0.3
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
+n=$((n+1))
+echo_i "check 'rndc serve-stale status' ($n)"
+ret=0
+$RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1
+grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=3600 stale-refresh-time=4)' rndc.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
 # Flush the cache to ensure the example/NS RRset cached during previous tests
 # does not override the authoritative delegation found in the root zone.
 n=$((n+1))
@@ -2542,6 +2550,15 @@ $RNDCCMD 10.53.0.3 flush > rndc.out.test$n 2>&1 || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
+# Test that after flush, serve-stale configuration is not reset.
+n=$((n+1))
+echo_i "check serve-stale configuration is not reset after flush ($n)"
+ret=0
+$RNDCCMD 10.53.0.3 serve-stale status > rndc.out.test$n 2>&1 || ret=1
+grep '_default: stale cache enabled; stale answers enabled (stale-answer-ttl=3 max-stale-ttl=3600 stale-refresh-time=4)' rndc.out.test$n > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
+
 # Query name server with low fetch limits. The authoritative server (ans2) is
 # not responding. Sending queries for multiple names in the 'example' zone
 # in parallel causes the fetch limit for that zone (set to 1) to be