]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Retry quiet to deal with kasp test timing issue
authorMatthijs Mekking <matthijs@isc.org>
Wed, 1 Jun 2022 09:49:20 +0000 (11:49 +0200)
committerMatthijs Mekking <matthijs@isc.org>
Tue, 7 Jun 2022 07:38:06 +0000 (09:38 +0200)
In the cases where we test SOA serial updates and TTL updates, we check
if for "all zones loaded" to ensure the new zone content is loaded. But
this is the unsigned zone, the signed zone still needs to be produced.

There is thus a timing issue where the dig request comes in before
the signing process has finished.

Add a retry quiet to mitigate against it.

(cherry picked from commit 827bba05a090cf392b1c54a4d857b7808c6a067f)

bin/tests/system/kasp/tests.sh

index 05c00f1707cdac6d1b8c9667d786bacd1b39a728..0db45f7544230dbcb8ec75c9cb1eb69cd501dc75 100644 (file)
@@ -4661,6 +4661,17 @@ dnssec_verify
 # an unlimited lifetime.  Fallback to the default loadkeys interval.
 check_next_key_event 3600
 
+_check_soa_ttl() {
+       dig_with_opts @10.53.0.6 example SOA > dig.out.ns6.test$n.soa2 || return 1
+       soa1=$(awk '$4 == "SOA" { print $7 }' dig.out.ns6.test$n.soa1)
+       soa2=$(awk '$4 == "SOA" { print $7 }' dig.out.ns6.test$n.soa2)
+       ttl1=$(awk '$4 == "SOA" { print $2 }' dig.out.ns6.test$n.soa1)
+       ttl2=$(awk '$4 == "SOA" { print $2 }' dig.out.ns6.test$n.soa2)
+       test ${soa1:-1000} -lt ${soa2:-0} || return 1
+       test ${ttl1:-0} -eq $1 || return 1
+       test ${ttl2:-0} -eq $2 || return 1
+}
+
 echo_i "Check that 'rndc reload' of just the serial updates the signed instance ($n)"
 TSIG=
 ret=0
@@ -4669,15 +4680,9 @@ cp ns6/example2.db.in ns6/example.db || ret=1
 nextpart ns6/named.run > /dev/null
 rndccmd 10.53.0.6 reload || ret=1
 wait_for_log 3 "all zones loaded" ns6/named.run
-sleep 1
-dig_with_opts @10.53.0.6 example SOA > dig.out.ns6.test$n.soa2 || ret=1
-soa1=$(awk '$4 == "SOA" { print $7 }' dig.out.ns6.test$n.soa1)
-soa2=$(awk '$4 == "SOA" { print $7 }' dig.out.ns6.test$n.soa2)
-ttl1=$(awk '$4 == "SOA" { print $2 }' dig.out.ns6.test$n.soa1)
-ttl2=$(awk '$4 == "SOA" { print $2 }' dig.out.ns6.test$n.soa2)
-test ${soa1:-1000} -lt ${soa2:-0} || ret=1
-test ${ttl1:-0} -eq 300 || ret=1
-test ${ttl2:-0} -eq 300 || ret=1
+# Check that the SOA SERIAL increases and check the TTLs (should be 300 as
+# defined in ns6/example2.db.in).
+retry_quiet 10 _check_soa_ttl 300 300 || ret=1
 test "$ret" -eq 0 || echo_i "failed"
 status=$((status+ret))
 n=$((n+1))
@@ -4693,15 +4698,9 @@ rm ns6/example.db.jnl
 nextpart ns6/named.run > /dev/null
 start_server --noclean --restart --port ${PORT} kasp ns6
 wait_for_log 3 "all zones loaded" ns6/named.run
-sleep 1
-dig_with_opts @10.53.0.6 example SOA > dig.out.ns6.test$n.soa2 || ret=1
-soa1=$(awk '$4 == "SOA" { print $7 }' dig.out.ns6.test$n.soa1)
-soa2=$(awk '$4 == "SOA" { print $7 }' dig.out.ns6.test$n.soa2)
-ttl1=$(awk '$4 == "SOA" { print $2 }' dig.out.ns6.test$n.soa1)
-ttl2=$(awk '$4 == "SOA" { print $2 }' dig.out.ns6.test$n.soa2)
-test ${soa1:-1000} -lt ${soa2:-0} || ret=1
-test ${ttl1:-0} -eq 300 || ret=1
-test ${ttl2:-0} -eq 400 || ret=1
+# Check that the SOA SERIAL increases and check the TTLs (should be changed
+# from 300 to 400 as defined in ns6/example3.db.in).
+retry_quiet 10 _check_soa_ttl 300 400 || ret=1
 test "$ret" -eq 0 || echo_i "failed"
 status=$((status+ret))
 n=$((n+1))