]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Require dnspython>2.0.0 in system tests using asyncserver
authorŠtěpán Balážik <stepan@isc.org>
Fri, 31 Oct 2025 11:04:39 +0000 (12:04 +0100)
committerŠtěpán Balážik <stepan@isc.org>
Wed, 5 Nov 2025 11:56:57 +0000 (11:56 +0000)
Maintaining compatibility with pre-2.0.0 dnspython became cumbersome
leading to failure in nightly CI jobs which are the only ones that run
with dnspython this old.

Abort all AsyncServer instances when running with old dnspython. Add an
importor skip for all system tests using isctest.asyncserver.

(cherry picked from commit 072a82a6c58075c248fc35503bfd31c43c112d69)

17 files changed:
bin/tests/system/chain/tests_sh_chain.py
bin/tests/system/cookie/tests_sh_cookie.py
bin/tests/system/dispatch/tests_connreset.py
bin/tests/system/dnssec/tests_sh_dnssec.py
bin/tests/system/fetchlimit/tests_sh_fetchlimit.py
bin/tests/system/forward/tests_sh_forward.py
bin/tests/system/hooks/tests_async_plugin.py
bin/tests/system/isctest/asyncserver.py
bin/tests/system/nsupdate/tests_sh_nsupdate.py
bin/tests/system/qmin/tests_sh_qmin.py
bin/tests/system/rpzrecurse/tests_sh_rpzrecurse.py
bin/tests/system/rpzrecurse/tests_sh_rpzrecurse_dnsrps.py
bin/tests/system/statistics/tests_sh_statistics.py
bin/tests/system/tsig/tests_badtime.py
bin/tests/system/upforwd/tests_sh_upforwd.py
bin/tests/system/xfer/tests_sh_xfer.py
bin/tests/system/zero/tests_sh_zero.py

index f7d7ac3b0158d4ed6e5b884b46924c1265f2267b..5aa86d9082f47cbb07598743d268d21db18078c2 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index 1c9e8280f5db7de302ce642d0e6a439e4871a41d..d5f88dedebdf552586b050a6fdfdd6f9df70f02b 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index 0b78fb8e0a6bb8b9c00e4dedf1f5111d9c7826b2..6c7f7140a60ea3c10d7b191787519f51d6bec7b2 100644 (file)
@@ -14,7 +14,9 @@
 import pytest
 import isctest
 
-pytest.importorskip("dns")
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 import dns.message
 
 pytestmark = pytest.mark.extra_artifacts(
index a824ee7ef9e5b18317d974b0391d0ea09c2a042c..7ccf7444202099cb6da97860e7f365cf65e1a555 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         ".hypothesis/examples/*",
index 23076980b5d7a9acb9134d497204e4ea624b0183..26bdff7fc24d7cceb0b9df74da06f271fc504e43 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index 0decea61e592fc613119aa18704565b31108b9ee..4ffec3fbd7de5176d9b87128e8ae6753287ff506 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index cb70c5c78c3c55cdb5e67a52c78f9e70dfab3220..4c3b1f714fee821a8dba1f0bc102738c2e00feed 100644 (file)
 # information regarding copyright ownership.
 
 import isctest
+import pytest
+
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
 
 
 def test_async_hook():
index e5277696cc3a5f170ff46b70601fa3b12b89dd7c..c91f63a12307826af76927902f45f91a81546e87 100644 (file)
@@ -116,6 +116,7 @@ class AsyncServer:
         tcp_handler: Optional[_TcpHandler],
         pidfile: Optional[str] = None,
     ) -> None:
+        self._abort_if_on_dnspython_version_less_than_2_0_0()
         logging.basicConfig(
             format="%(asctime)s %(levelname)8s  %(message)s",
             level=os.environ.get("ANS_LOG_LEVEL", "INFO").upper(),
@@ -143,6 +144,14 @@ class AsyncServer:
         self._pidfile: Optional[str] = pidfile
         self._work_done: Optional[asyncio.Future] = None
 
+    @classmethod
+    def _abort_if_on_dnspython_version_less_than_2_0_0(cls) -> None:
+        if dns.version.MAJOR < 2:
+            error = f"Using {cls.__name__} requires dnspython >= 2.0.0; "
+            error += 'add `pytest.importorskip("dns", minversion="2.0.0")` '
+            error += "to the test module to skip this test."
+            raise RuntimeError(error)
+
     def _get_ipv4_address_from_directory_name(self) -> str:
         containing_directory = pathlib.Path().absolute().stem
         match_result = re.match(r"ans(?P<index>\d+)", containing_directory)
@@ -1053,7 +1062,6 @@ class AsyncDnsServer(AsyncServer):
         try:
             query = dns.message.from_wire(wire)
         except dns.message.UnknownTSIGKey:
-            self._abort_if_on_dnspython_version_less_than_2_0_0()
             self._abort_if_tsig_signed_query_received_unless_acknowledged()
             query = _DnsMessageWithTsigDisabled.from_wire(wire)
         except dns.exception.DNSException as exc:
@@ -1074,13 +1082,6 @@ class AsyncDnsServer(AsyncServer):
                     response_length = struct.pack("!H", len(response))
                     yield response_length + response
 
-    def _abort_if_on_dnspython_version_less_than_2_0_0(self) -> None:
-        if dns.version.MAJOR < 2:
-            error = "Receiving TSIG signed queries requires dnspython >= 2.0.0; "
-            error += 'add `pytest.importorskip("dns", minversion="2.0.0")` '
-            error += "to the test module to skip this test."
-            raise RuntimeError(error)
-
     def _abort_if_tsig_signed_query_received_unless_acknowledged(self) -> None:
         if self._acknowledge_tsig_dnspython_hacks:
             return
index bd41ac64c51535be419972d19197982844bd488a..c4ce9ab6f002a98c4132bc99c8466a588734e864 100644 (file)
@@ -13,6 +13,9 @@ import platform
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "Kxxx*",
index 1116f7ec6ce0ca50603ded14ffd33ae66ed8aebd..4f5af7f56c1ec9de08681fea8aae18938e617fcd 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index 983c6c3c331a0bb2696252739500ab71bb4a6bc9..3798ed6ee671d8222d6e9ecc347a9eec68fd0134 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out.*",
index a32d70cd7aa91a1872fc96b41cc2b9258ecb4886..427af96a794c2ac38c51d525a24e55a7cdeb41f1 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 import isctest.mark
 
 pytestmark = [
index c96bb28808201857b2482afbc4dc854b7d594885..7f3035b0fae50ab7c4afb2239959aaa29c0b2369 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "curl.out.*",
index 1a45e51ec03456e3c763006b060c1861562a5fa4..4f5a1b9f9741743f47eb296f5e76a4e1736b99a2 100644 (file)
@@ -18,7 +18,9 @@ import time
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
 pytest.importorskip("dns", minversion="2.0.0")
+
 import dns.message
 import dns.query
 import dns.tsigkeyring
index 3dfa290a3161ad43addc2d34dc4a63878cfa1511..28be6c4c2d7e8dab1e717b37e01678768d9f404c 100644 (file)
@@ -11,6 +11,8 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index d94f90b98113c2c8754a045be410e84689f44c35..5226cfc50b20181115064a173be8d6ead0836f2c 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "axfr.out",
index 3191f1c62a8ac5c3415f41c013051a3e3d36483e..50abfe0f2d635effd4529154d951ba3c262215c6 100644 (file)
@@ -11,6 +11,9 @@
 
 import pytest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "dig.out*",