]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix fetchlimit system test issues
authorAram Sargsyan <aram@isc.org>
Mon, 29 May 2023 14:17:01 +0000 (14:17 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 6 Jun 2023 12:45:00 +0000 (12:45 +0000)
1. Fix the numbering.
2. Fix an artifacts rewriting issue.
3. Add missing checks of 'ret' after some checks.
4. Fix extracting the quota value from the ADB dump.

(cherry picked from commit 101d829b02b50713c036d6989e64519d090ae796)

bin/tests/system/fetchlimit/tests.sh

index d94539290b213f915aed71f288793c8d0f66dfcc..0e3aadd4062b32f975e5a757059671004375f432 100644 (file)
@@ -37,9 +37,11 @@ stat() {
     return 0
 }
 
+n=0
 status=0
 
-echo_i "checking recursing clients are dropped at the per-server limit"
+n=$((n + 1))
+echo_i "checking recursing clients are dropped at the per-server limit ($n)"
 ret=0
 # make the server lame and restart
 $RNDCCMD flush
@@ -57,15 +59,20 @@ done
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
-echo_i "dumping ADB data"
+n=$((n + 1))
+echo_i "dumping ADB data ($n)"
+ret=0
 $RNDCCMD dumpdb -adb
 info=`grep '10.53.0.4' ns3/named_dump.db | sed 's/.*\(atr [.0-9]*\).*\(quota [0-9]*\).*/\1 \2/'`
 echo_i $info
 set -- $info
-quota=$5
-[ ${5:-200} -lt 200 ] || ret=1
+quota=$4
+[ ${4:-200} -lt 200 ] || ret=1
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
-echo_i "checking servfail statistics"
+n=$((n + 1))
+echo_i "checking servfail statistics ($n)"
 ret=0
 rm -f ns3/named.stats
 $RNDCCMD stats
@@ -81,7 +88,8 @@ fails=`grep 'queries resulted in SERVFAIL' ns3/named.stats | sed 's/\([0-9][0-9]
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
-echo_i "checking lame server recovery"
+n=$((n + 1))
+echo_i "checking lame server recovery ($n)"
 ret=0
 rm -f ans4/norespond
 for try in 1 2 3 4 5; do
@@ -90,46 +98,60 @@ for try in 1 2 3 4 5; do
     [ $ret -eq 1 ] && break
     sleep 1
 done
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
-echo_i "dumping ADB data"
+n=$((n + 1))
+echo_i "dumping ADB data ($n)"
+ret=0
 $RNDCCMD dumpdb -adb
 info=`grep '10.53.0.4' ns3/named_dump.db | sed 's/.*\(atr [.0-9]*\).*\(quota [0-9]*\).*/\1 \2/'`
 echo_i $info
 set -- $info
-[ ${5:-${quota}} -lt $quota ] || ret=1
-quota=$5
+[ ${4:-${quota}} -lt $quota ] || ret=1
+quota=$4
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
+n=$((n + 1))
+echo_i "checking lame server recovery (continued) ($n)"
+ret=0
 for try in 1 2 3 4 5 6 7 8 9 10; do
     burst c $try
     stat 0 20 || ret=1
     [ $ret -eq 1 ] && break
     sleep 1
 done
+if [ $ret != 0 ]; then echo_i "failed"; fi
+status=$((status+ret))
 
-echo_i "dumping ADB data"
+n=$((n + 1))
+echo_i "dumping ADB data ($n)"
+ret=0
 $RNDCCMD dumpdb -adb
 info=`grep '10.53.0.4' ns3/named_dump.db | sed 's/.*\(atr [.0-9]*\).*\(quota [0-9]*\).*/\1 \2/'`
 echo_i $info
 set -- $info
-[ ${5:-${quota}} -gt $quota ] || ret=1
-quota=$5
+[ ${4:-${quota}} -gt $quota ] || ret=1
+quota=$4
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
 copy_setports ns3/named2.conf.in ns3/named.conf
 rndc_reconfig ns3 10.53.0.3
 
-echo_i "checking lame server clients are dropped at the per-domain limit"
+n=$((n + 1))
+echo_i "checking lame server clients are dropped at the per-domain limit ($n)"
 ret=0
 fail=0
 success=0
 touch ans4/norespond
 for try in 1 2 3 4 5; do
     burst b $try 300
-    $DIGCMD a ${try}.example > dig.out.ns3.$try
-    grep "status: NOERROR" dig.out.ns3.$try > /dev/null 2>&1 && \
+    $DIGCMD a ${try}.example > dig.out.ns3.$n.$try
+    grep "status: NOERROR" dig.out.ns3.$n.$try > /dev/null 2>&1 && \
             success=$((success+1))
-    grep "status: SERVFAIL" dig.out.ns3.$try > /dev/null 2>&1 && \
+    grep "status: SERVFAIL" dig.out.ns3.$n.$try > /dev/null 2>&1 && \
             fail=$(($fail+1))
     stat 30 50 || ret=1
     [ $ret -eq 1 ] && break
@@ -140,7 +162,9 @@ echo_i "$success successful valid queries, $fail SERVFAIL"
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
-echo_i "checking drop statistics"
+n=$((n + 1))
+echo_i "checking drop statistics ($n)"
+ret=0
 rm -f ns3/named.stats
 $RNDCCMD stats
 for try in 1 2 3 4 5; do
@@ -158,7 +182,8 @@ status=$((status+ret))
 copy_setports ns3/named3.conf.in ns3/named.conf
 rndc_reconfig ns3 10.53.0.3
 
-echo_i "checking lame server clients are dropped below the hard limit"
+n=$((n + 1))
+echo_i "checking lame server clients are dropped below the hard limit ($n)"
 ret=0
 fail=0
 exceeded=0
@@ -166,11 +191,11 @@ success=0
 touch ans4/norespond
 for try in 1 2 3 4 5; do
     burst b $try 400
-    $DIGCMD +time=2 a ${try}.example > dig.out.ns3.$try
+    $DIGCMD +time=2 a ${try}.example > dig.out.ns3.$n.$try
     stat 1 400 || exceeded=$((exceeded + 1))
-    grep "status: NOERROR" dig.out.ns3.$try > /dev/null 2>&1 && \
+    grep "status: NOERROR" dig.out.ns3.$n.$try > /dev/null 2>&1 && \
             success=$((success+1))
-    grep "status: SERVFAIL" dig.out.ns3.$try > /dev/null 2>&1 && \
+    grep "status: SERVFAIL" dig.out.ns3.$n.$try > /dev/null 2>&1 && \
             fail=$(($fail+1))
     sleep 1
 done
@@ -183,7 +208,9 @@ echo_i "clients count exceeded 400 on $exceeded trials (expected 0)"
 if [ $ret != 0 ]; then echo_i "failed"; fi
 status=$((status+ret))
 
-echo_i "checking drop statistics"
+n=$((n + 1))
+echo_i "checking drop statistics ($n)"
+ret=0
 rm -f ns3/named.stats
 touch ns3/named.stats
 $RNDCCMD stats