]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix `cyclic_glue` system test 11934/head
authorColin Vidal <colin@isc.org>
Thu, 30 Apr 2026 13:18:03 +0000 (14:18 +0100)
committerColin Vidal <colin@isc.org>
Thu, 30 Apr 2026 14:31:16 +0000 (16:31 +0200)
The `cyclic_glue` system test was not explicitly waiting for the dump to
complete. As a result, the test could read an outdated dump file and
perform assertions on database state. Fix this by waiting for `dumpdb`
command to finish before reading `named_dump.db`.

bin/tests/system/cyclic_glue/tests_cyclic_glue.py

index ff71db7a6bb4a45bd5ac3a5b0f64ec10ff10878d..3f52255a5b5ffdec0953af9a97d935b054b41169 100644 (file)
@@ -14,7 +14,7 @@ from re import compile as Re
 import isctest
 
 
-def run_queries(ns):
+def query_and_dump(ns):
     msg = isctest.query.create("a.foo.test.", "A")
     res = isctest.query.udp(msg, ns.ip)
     isctest.check.noerror(res)
@@ -23,11 +23,14 @@ def run_queries(ns):
     res = isctest.query.udp(msg, ns.ip)
     isctest.check.noerror(res)
 
+    with ns.watch_log_from_here() as watcher:
+        ns.rndc("dumpdb -deleg")
+        watcher.wait_for_line("dumpdb complete")
+    return isctest.text.TextFile(f"{ns.identifier}/named_dump.db")
+
 
 def test_cyclic_glues(ns1, ns4, templates):
-    run_queries(ns4)
-    ns4.rndc("dumpdb -deleg")
-    dump = isctest.text.TextFile("ns4/named_dump.db")
+    dump = query_and_dump(ns4)
 
     # The test is using the correctly-behaving ns2 server.
     assert len(dump.grep(Re("test. .* DELEG server-ipv4=10.53.0.2"))) == 1
@@ -53,9 +56,7 @@ def test_cyclic_glues(ns1, ns4, templates):
         ns4.rndc("flush")
         watcher.wait_for_line("flushing caches in all views succeeded")
 
-    run_queries(ns4)
-    ns4.rndc("dumpdb -deleg")
-    dump = isctest.text.TextFile("ns4/named_dump.db")
+    dump = query_and_dump(ns4)
 
     # The test is now using the broken ans5 server.
     assert len(dump.grep(Re("test. [0-9]* DELEG server-ipv4=10.53.0.2"))) == 0