Merge branch '3013-resolver-test-failure' into 'main'

fix intermittent resolver test error

Closes #3013

See merge request isc-projects/bind9!5576
This commit is contained in:
Evan Hunt
2021-11-22 23:18:57 +00:00
2 changed files with 16 additions and 16 deletions

View File

@@ -14,7 +14,7 @@
#
rm -f */named.conf
rm -f */named.memstats
rm -f */named.run
rm -f */named.run */named.run.prev
rm -f */ans.run
rm -f */*.jdb
rm -f dig.out dig.out.* dig.*.out.*

View File

@@ -256,10 +256,17 @@ status=`expr $status + $ret`
n=`expr $n + 1`
echo_i "check that the resolver limits the number of NS records it follows in a referral response ($n)"
# ns5 is the recusor being tested. ns4 holds the sourcens zone containing names with varying numbers of NS
# records pointing to non-existent nameservers in the targetns zone on ns6.
# ns5 is the recusor being tested. ns4 holds the sourcens zone containing
# names with varying numbers of NS records pointing to non-existent
# nameservers in the targetns zone on ns6.
ret=0
$RNDCCMD 10.53.0.5 flush || ret=1 # Ensure cache is empty before doing this test
count_fetches () {
actual=$(nextpartpeek ns5/named.run |
grep " fetch: ns.fake${nscount}" | wc -l)
[ ${actual:-0} -eq ${expected} ] || return 1
return 0
}
for nscount in 1 2 3 4 5 6 7 8 9 10
do
# Verify number of NS records at source server
@@ -267,23 +274,16 @@ do
sourcerecs=`grep NS dig.ns4.out.${nscount}.${n} | grep -v ';' | wc -l`
test $sourcerecs -eq $nscount || ret=1
test $sourcerecs -eq $nscount || echo_i "NS count incorrect for target${nscount}.sourcens"
# Expected queries = 2 * number of NS records, up to a maximum of 10.
expected=`expr 2 \* $nscount`
if [ $expected -gt 10 ]; then expected=10; fi
# Work out the queries made by checking statistics on the target before and after the test
$RNDCCMD 10.53.0.6 stats || ret=1
initial_count=`awk '/responses sent/ {print $1}' ns6/named.stats`
mv ns6/named.stats ns6/named.stats.initial.${nscount}.${n}
# Count the number of logged fetches
nextpart ns5/named.run > /dev/null
$DIG $DIGOPTS @10.53.0.5 target${nscount}.sourcens A > dig.ns5.out.${nscount}.${n} || ret=1
$RNDCCMD 10.53.0.6 stats || ret=1
final_count=`awk '/responses sent/ {print $1}' ns6/named.stats`
mv ns6/named.stats ns6/named.stats.final.${nscount}.${n}
# Check number of queries during the test is as expected
actual=`expr $final_count - $initial_count`
if [ $actual -ne $expected ]; then
echo_i "query count error: $nscount NS records: expected queries $expected, actual $actual"
ret=1
fi
retry_quiet 5 count_fetches ns5/named.run $nscount $expected || {
echo_i "query count error: $nscount NS records: expected queries $expected, actual $actual"; ret=1;
}
done
if [ $ret != 0 ]; then echo_i "failed"; fi
status=`expr $status + $ret`