From 5bb7d952a70a58e5118a9ccf82f47afbeb06f918 Mon Sep 17 00:00:00 2001 From: Matthijs Mekking Date: Thu, 29 Feb 2024 11:12:50 +0100 Subject: [PATCH 1/2] Fix xferquota system test The change from RBT to QP has changed the contents of generated zone files slightly: node names are now always absolute, so instead of using $ORIGIN and relative names, generated zone files use full names for all records. This caused a failure in the xferquota system test, which was looking for a relative name in secondary zone files. Replace the string matching with a regular expression to fix the test. (cherry picked from commit 618c963cb75b3677d5d2e4ff9059a965f09fcb13) --- bin/tests/system/xferquota/tests_xferquota.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/tests/system/xferquota/tests_xferquota.py b/bin/tests/system/xferquota/tests_xferquota.py index dbc29b937d..ee71ec8488 100644 --- a/bin/tests/system/xferquota/tests_xferquota.py +++ b/bin/tests/system/xferquota/tests_xferquota.py @@ -36,7 +36,7 @@ def test_xferquota(named_port, servers): with open(file_path, "r", encoding="utf-8") as zonefile: # Count the number of lines containing the search string for line in zonefile: - if "xyzzy A 10.0.0.2" in line: + if re.search(r"xyzzy.zone[0-9]+.example.*A\s+10\.0\.0\.2", line): matching_line_count += 1 return matching_line_count == 300 From e27acff332b3fe75f9dee92bbc1328184bd8fd46 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 2 May 2024 15:31:18 +1000 Subject: [PATCH 2/2] Address qp/rbtdb backup file style differences 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 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bin/tests/system/xferquota/tests_xferquota.py b/bin/tests/system/xferquota/tests_xferquota.py index ee71ec8488..3b9572f1bd 100644 --- a/bin/tests/system/xferquota/tests_xferquota.py +++ b/bin/tests/system/xferquota/tests_xferquota.py @@ -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)