From 611a556a6cc688afd88f36ff13b3283c8c937503 Mon Sep 17 00:00:00 2001 From: Colin Vidal Date: Wed, 5 Nov 2025 15:08:51 +0100 Subject: [PATCH] harden ede24 system test 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 | 2 +- bin/tests/system/ede24/tests_ede24.py | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/bin/tests/system/ede24/ns1/foo.fr.db b/bin/tests/system/ede24/ns1/foo.fr.db index f3937c043c..262895e1a9 100644 --- a/bin/tests/system/ede24/ns1/foo.fr.db +++ b/bin/tests/system/ede24/ns1/foo.fr.db @@ -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. diff --git a/bin/tests/system/ede24/tests_ede24.py b/bin/tests/system/ede24/tests_ede24.py index 7c5771715e..a492ff7457 100644 --- a/bin/tests/system/ede24/tests_ede24.py +++ b/bin/tests/system/ede24/tests_ede24.py @@ -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")