]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
harden ede24 system test
authorColin Vidal <colin@isc.org>
Wed, 5 Nov 2025 14:08:51 +0000 (15:08 +0100)
committerColin Vidal <colin@isc.org>
Thu, 6 Nov 2025 14:11:45 +0000 (15:11 +0100)
There was a random failure of ede24 system test. While this is still a
bit speculative, the two reasons were:

- in the case of `test_ede24_noloaded` the test might attempt to early
  (before the zone actually transfered on the secondary server) to query
  ns2.

- still in the case of `test_ede24_noloaded`, even after waiting for
  transfer succeed logs, if the CI machine is slow, the zone could be
  expired before the request checking the secondary zone works because
  the expiration time of the zone was very short (1s). Moving this
  expiration time to 3 seconds should be enough (while not making the
  test execution too much longer when waiting for the zone expiration).

- in the case of `test_ede24_expired`, the zone expired flag is flipped
  and the log message is printed immediately after. However, it is
  possible that because the flag is set using a relaxed atomic
  operation, another thread process the query and gets the previous
  (non-expired) value of the flag. In order to workaround this, the
  test now also expects another log written after the zone expiration
  (stop timers) on the next UV tick.

bin/tests/system/ede24/ns1/foo.fr.db
bin/tests/system/ede24/tests_ede24.py

index f3937c043c00d7d5ed47aeeecf235a4cc1995343..262895e1a9a0f13ab6288826c324fbc011846fdc 100644 (file)
@@ -14,7 +14,7 @@ foo.fr. IN SOA        ns.foo.fr. op.foo.fr. (
                                3       ; serial
                                1       ; refresh
                                1       ; retry
-                               1       ; expire
+                               3       ; expire
                                60      ; minimum
                                )
 foo.fr.                NS      ns.foo.fr.
index 7c5771715ee0849d84c6d18958737ac543da1649..a492ff74577c9c1160d749fffe1e5ecc32023c3e 100644 (file)
@@ -34,7 +34,10 @@ def check_soa_servfail_ede24(edemsg):
 
 
 def test_ede24_noloaded(ns1, ns2):
-    # Sanity check that everything works first
+    # Sanity check that everything works first, once we're sure the foo.fr zone
+    # has transfered to ns2.
+    with ns2.watch_log_from_start() as watcher:
+        watcher.wait_for_line("Transfer status: success")
     check_soa_noerror()
 
     # Stop all servers, and we'll restart only ns2.
@@ -59,7 +62,11 @@ def test_ede24_expired(ns1, ns2):
     # Stop the primary and wait for expiration of the zone in the secondary.
     with ns2.watch_log_from_here() as watcher:
         ns1.stop()
-        watcher.wait_for_line(" zone foo.fr/IN: expired")
+        log_sequence = [
+            " zone foo.fr/IN: expired",
+            " zone foo.fr/IN: stop zone timer",
+        ]
+        watcher.wait_for_sequence(log_sequence)
 
     # ns2 can't answer anymore.
     check_soa_servfail_ede24("zone expired")