]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix statistics test error
authorEvan Hunt <each@isc.org>
Sun, 17 Oct 2021 18:45:21 +0000 (11:45 -0700)
committerEvan Hunt <each@isc.org>
Wed, 27 Oct 2021 19:56:51 +0000 (12:56 -0700)
The statistics system test sometimes needs a pause to wait for the
expected stats to be reported.

Also, the test for priming queries was ineffective; the result of
the grep was not being checked.

(cherry picked from commit c167feb1dc9d35bc8770c4311a0987f702a1da47)

bin/tests/system/statistics/tests.sh

index 5091d12052e9a34e0850ef5480d94c9ea44901cf..710236a5200d5c6580083abc859d20e28b2d1443 100644 (file)
@@ -91,7 +91,11 @@ $DIGCMD +tries=2 +time=1 +recurse @10.53.0.3 foo.info. any > /dev/null 2>&1
 
 ret=0
 echo_i "dumping updated stats for ns3 ($n)"
-rndc_stats ns3 10.53.0.3 || ret=1
+getstats() {
+    rndc_stats ns3 10.53.0.3 || return 1
+    grep "2 recursing clients" $last_stats > /dev/null || return 1
+}
+retry_quiet 5 getstats || ret=1
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
@@ -137,6 +141,13 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
+ret=0
+echo_i "checking priming queries are counted ($n)"
+grep "priming queries" $last_stats > /dev/null || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=`expr $status + $ret`
+n=`expr $n + 1`
+
 ret=0
 echo_i "checking that zones with slash are properly shown in XML output ($n)"
 if $FEATURETEST --have-libxml2 && [ -x ${CURL} ] ; then
@@ -239,13 +250,6 @@ if [ $ret != 0 ]; then echo_i "failed"; fi
 status=`expr $status + $ret`
 n=`expr $n + 1`
 
-ret=0
-echo_i "checking priming queries are counted ($n)"
-grep "1 priming queries" $last_stats
-if [ $ret != 0 ]; then echo_i "failed"; fi
-status=`expr $status + $ret`
-n=`expr $n + 1`
-
 echo_i "Check that 'zone-statistics full;' is processed by 'rndc reconfig' ($n)"
 ret=0
 # off by default