]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
cdnxdomain test is failing on some platforms 12372/head
authorMark Andrews <marka@isc.org>
Thu, 9 Jul 2026 04:47:28 +0000 (14:47 +1000)
committerMark Andrews <marka@isc.org>
Tue, 14 Jul 2026 16:05:35 +0000 (02:05 +1000)
Ensure the modification time is newer (second granuality) when the
zone file is rewritten as named uses the file modification time to
determine if it needs to reload a file.

bin/tests/system/cdnxdomain/tests_cdnxdomain.py

index 4f211f0be51969b6e1645ab701eb4d3bd8b26467..6448dd7b515c9596533346f5e9307f8ddcf291bc 100644 (file)
@@ -76,7 +76,20 @@ ns2 A 10.53.0.2
 def _serve(ns2, system_test_dir, variant):
     """Make ns2 serve the 'full' or 'empty' (a.example-less) signed zone."""
     src = system_test_dir / "ns2" / f"example-{variant}.db.signed"
-    shutil.copyfile(src, system_test_dir / "ns2" / "example.db.signed")
+    dst = system_test_dir / "ns2" / "example.db.signed"
+    # Ensure that the modification time of 'dst' increases on
+    # file systems with seconds granuality.
+    st_ok = False
+    try:
+        st = os.stat(dst)
+        st_ok = True
+    except FileNotFoundError:
+        pass
+    shutil.copyfile(src, dst)
+    if st_ok:
+        st2 = os.stat(dst)
+        if int(st2.st_mtime) <= int(st.st_mtime):
+            os.utime(dst, (st2.st_atime, st.st_mtime + 1))
     ns2.reload()