Fix tests for parent-centric resolver behavior

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.
This commit is contained in:
Evan Hunt 2026-02-11 13:56:59 -08:00 committed by Colin Vidal
parent 1ff19bd43d
commit 8d3df06100
3 changed files with 14 additions and 4 deletions

View 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

View file

@ -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

View file

@ -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))