]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use bootstrap() in pytest where applicable
authorNicki Křížek <nicki@isc.org>
Thu, 25 Sep 2025 15:30:12 +0000 (17:30 +0200)
committerNicki Křížek <nicki@isc.org>
Tue, 21 Oct 2025 14:16:16 +0000 (16:16 +0200)
Replace the autouse fixtures which were only used to change the initial
server configuration into proper bootstrap() functions. This gets rid of
an extraneous reconfigure.

In the tests_validation_many_anchors.py, split the fixture into a proper
bootstrap() and a separate test for checking the expected log lines for
the ignored keys. Previously, the test was broken - it should check for
all the messages being present in the log, and some of the keys are
actually initial-key rather than static-key. This has been fixed in the
parametrized test.

(cherry picked from commit fb4345afd43263f8c4c842e731f9262a75d4f61b)

bin/tests/system/filters/common.py
bin/tests/system/filters/tests_filter_a_v4.py
bin/tests/system/filters/tests_filter_a_v6.py
bin/tests/system/filters/tests_filter_aaaa_v4.py
bin/tests/system/filters/tests_filter_aaaa_v6.py

index a009d31c0a556809e03b764972333a75e6f6250e..4944775ed13cce5e14559eb4fc1ae9d8f26651a2 100644 (file)
@@ -25,14 +25,6 @@ ARTIFACTS = [
 ]
 
 
-def reconfigure_servers(ftype, family, servers, templates):
-    for server_id in ["ns1", "ns2", "ns3", "ns4"]:
-        templates.render(
-            f"{server_id}/named.conf", {"family": family, "filtertype": ftype}
-        )
-        servers[server_id].reconfigure(log=False)
-
-
 def check_filtertype_only(dest, source, qname, ftype, expected, adflag):
     qname = dns.name.from_text(qname)
 
index e5aea1bcfb86312ae7e42bc0a58b71e7791c51a3..e38821b08ba149afb9f5e6d18f2febeff1c6fa11 100644 (file)
@@ -18,17 +18,21 @@ from filters.common import (
     check_filter,
     check_filter_other_family,
     prime_cache,
-    reconfigure_servers,
 )
 
 
 pytestmark = pytest.mark.extra_artifacts(ARTIFACTS)
 
 
+def bootstrap():
+    return {
+        "family": "v4",
+        "filtertype": "a",
+    }
+
+
 @pytest.fixture(scope="module", autouse=True)
-def setup_filters(servers, templates):
-    isctest.log.info("configuring server to filter A on V4")
-    reconfigure_servers("a", "v4", servers, templates)
+def setup_filters():
     prime_cache("10.53.0.2")
     prime_cache("10.53.0.3")
 
index 17e14e8b34d25e3b8aedb3c7900567dd68718b42..f077fad575349c657d5eb1e18e88228e063508f7 100644 (file)
@@ -18,17 +18,21 @@ from filters.common import (
     check_filter,
     check_filter_other_family,
     prime_cache,
-    reconfigure_servers,
 )
 
 
 pytestmark = pytest.mark.extra_artifacts(ARTIFACTS)
 
 
+def bootstrap():
+    return {
+        "family": "v6",
+        "filtertype": "a",
+    }
+
+
 @pytest.fixture(scope="module", autouse=True)
-def setup_filters(servers, templates):
-    isctest.log.info("configuring server to filter A on V6")
-    reconfigure_servers("a", "v6", servers, templates)
+def setup_filters():
     prime_cache("fd92:7065:b8e:ffff::2")
     prime_cache("fd92:7065:b8e:ffff::3")
 
index 90aac2a0cd3bacd41a9b57ee78f21e53bfeaf201..eb232175024f5f6001f6115ade214f0ae885b88c 100644 (file)
@@ -19,17 +19,21 @@ from filters.common import (
     check_filter,
     check_filter_other_family,
     prime_cache,
-    reconfigure_servers,
 )
 
 
 pytestmark = pytest.mark.extra_artifacts(ARTIFACTS)
 
 
+def bootstrap():
+    return {
+        "family": "v4",
+        "filtertype": "aaaa",
+    }
+
+
 @pytest.fixture(scope="module", autouse=True)
-def setup_filters(servers, templates):
-    isctest.log.info("configuring server to filter AAAA on V4")
-    reconfigure_servers("aaaa", "v4", servers, templates)
+def setup_filters():
     prime_cache("10.53.0.2")
     prime_cache("10.53.0.3")
 
index a439316677d3be655c062a7c913dd81e553e1320..e1a4f74cef9ed14dde2d3537c1ce8577836fc310 100644 (file)
@@ -18,17 +18,21 @@ from filters.common import (
     check_filter,
     check_filter_other_family,
     prime_cache,
-    reconfigure_servers,
 )
 
 
 pytestmark = pytest.mark.extra_artifacts(ARTIFACTS)
 
 
+def bootstrap():
+    return {
+        "family": "v6",
+        "filtertype": "aaaa",
+    }
+
+
 @pytest.fixture(scope="module", autouse=True)
-def setup_filters(servers, templates):
-    isctest.log.info("configuring server to filter AAAA on V6")
-    reconfigure_servers("aaaa", "v6", servers, templates)
+def setup_filters():
     prime_cache("fd92:7065:b8e:ffff::2")
     prime_cache("fd92:7065:b8e:ffff::3")