]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Address qp/rbtdb backup file style differences
authorMark Andrews <marka@isc.org>
Thu, 2 May 2024 05:31:18 +0000 (15:31 +1000)
committerMichal Nowak <mnowak@isc.org>
Wed, 15 May 2024 08:58:42 +0000 (10:58 +0200)
qp and rbtdb produce stylistically different backup files.  This
was causing the xferquota system test to fail.  This has been
addressed by making the test independent of the stylistic differences.

(cherry picked from commit 1482e9bbb9f828fda0f0171823ce6c192b64a195)

bin/tests/system/xferquota/tests_xferquota.py

index ee71ec8488ae94368e7307c7687a21a19790f4a0..3b9572f1bdc6bec12acc48fd08313d27a2d47d86 100644 (file)
@@ -31,13 +31,17 @@ def test_xferquota(named_port, servers):
 
     def check_line_count():
         matching_line_count = 0
-        # Iterate through zone files and count matching lines
+        # Iterate through zone files and count matching lines (records)
         for file_path in glob.glob("ns2/zone000*.example.bk"):
-            with open(file_path, "r", encoding="utf-8") as zonefile:
-                # Count the number of lines containing the search string
-                for line in zonefile:
-                    if re.search(r"xyzzy.zone[0-9]+.example.*A\s+10\.0\.0\.2", line):
-                        matching_line_count += 1
+            zone = dns.zone.from_file(
+                file_path, origin=file_path[4:-2], relativize=False
+            )
+            for name, _ttl, rdata in zone.iterate_rdatas(rdtype="A"):
+                if (
+                    re.fullmatch("xyzzy.zone[0-9]+.example.", name.to_text())
+                    and rdata.to_text() == "10.0.0.2"
+                ):
+                    matching_line_count += 1
         return matching_line_count == 300
 
     isctest.run.retry_with_timeout(check_line_count, timeout=360)