]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix tests for parent-centric resolver behavior
authorEvan Hunt <each@isc.org>
Wed, 11 Feb 2026 21:56:59 +0000 (13:56 -0800)
committerColin Vidal <colin@isc.org>
Mon, 30 Mar 2026 18:41:13 +0000 (20:41 +0200)
In 'additional', pre-cache the A RRset for ns1.rt.example so the
additional-data handling in the cache can be tested; previously this
was cached as part of resolution, but now must be queried explicitly.

In 'cookie', pre-cache an NS to prevent a QMIN query from distorting
log results and causing a test failure.

In 'resolver', increase the expected query count in the timeout test.

bin/tests/system/additional/tests.sh
bin/tests/system/cookie/tests.sh
bin/tests/system/resolver/tests.sh

index 27dca50e7978c2e32e42b16d2cac6b0a1b678fe9..e434474ab196bef69800eddaa4c77e97f390632b 100644 (file)
@@ -373,6 +373,8 @@ fi
 n=$((n + 1))
 echo_i "testing NS handling in ANY responses (recursive) ($n)"
 ret=0
+# pre-cache the address record
+$DIG $DIGOPTS -t A ns1.rt.example @10.53.0.3 >/dev/null || ret=1
 $DIG $DIGOPTS -t ANY rt.example @10.53.0.3 >dig.out.$n || ret=1
 grep "AUTHORITY: 0" dig.out.$n >/dev/null || ret=1
 grep "NS[      ]*ns" dig.out.$n >/dev/null || ret=1
index 5c08beb05c85298b7979c96089380330e5a2cf00..36ba494030049fec21abce393ed0e936d0f6e0fb 100755 (executable)
@@ -566,7 +566,7 @@ sys.exit(1)'; then
   ret=0
   pat='10\.53\.0\.10 .*\[cookie=................................\] \[ttl'
   # prime EDNS COOKIE state
-  $DIG $DIGOPTS @10.53.0.1 tsig. >dig.out.test$n.1 || ret=1
+  $DIG $DIGOPTS @10.53.0.1 NS tsig. >dig.out.test$n.1 || ret=1
   grep "status: NOERROR" dig.out.test$n.1 >/dev/null || ret=1
   rndc_dumpdb ns1
   # prime cache with NS response for QNAME minimisation
index bd8f8972c231b7968b653b1079dc90300d7c33df..e9affc1cb4dfee304b02555c8819b20637a62ab0 100755 (executable)
@@ -76,13 +76,21 @@ n=$((n + 1))
 echo_i "checking that the timeout didn't skew the resolver responses counters and did update the timeout counter ($n)"
 ret=0
 rndccmd 10.53.0.1 stats || ret=1
+# the timeout query triggers two extra queries, so we expect a small increase
 grep -F 'responses received' ns1/named.stats >ns1/named.stats.responses-after || true
+read before _ <ns1/named.stats.responses-before || true
+read after _ <ns1/named.stats.responses-after || true
+[ $((after - before)) -lt 3 ] || ret=1
 grep -F 'queries with RTT' ns1/named.stats >ns1/named.stats.rtt-after || true
+read before _ <ns1/named.stats.rtt-before || true
+read after _ <ns1/named.stats.rtt-after || true
+[ $((after - before)) -lt 3 ] || ret=1
+# ...but the timeout counter should increase by more
 grep -F 'query timeouts' ns1/named.stats >ns1/named.stats.timeouts-after || true
 mv ns1/named.stats ns1/named.stats-after
-diff ns1/named.stats.responses-before ns1/named.stats.responses-after >/dev/null || ret=1
-diff ns1/named.stats.rtt-before ns1/named.stats.rtt-after >/dev/null || ret=1
-diff ns1/named.stats.timeouts-before ns1/named.stats.timeouts-after >/dev/null && ret=1
+read before _ <ns1/named.stats.timeouts-before || true
+read after _ <ns1/named.stats.timeouts-after || true
+[ $((after - before)) -ge 3 ] || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status + ret))