]> 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>
Tue, 4 Nov 2025 15:57:59 +0000 (16:57 +0100)
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.

25 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_badkey.py
bin/tests/system/dnssec/tests_badkey_broken.py
bin/tests/system/dnssec/tests_badkey_revoked.py
bin/tests/system/dnssec/tests_delv.py
bin/tests/system/dnssec/tests_policy.py
bin/tests/system/dnssec/tests_tat.py
bin/tests/system/dnssec/tests_validation.py
bin/tests/system/dnssec/tests_validation_accept_expired.py
bin/tests/system/dnssec/tests_validation_managed_keys.py
bin/tests/system/dnssec/tests_validation_many_anchors.py
bin/tests/system/dnssec/tests_validation_multiview.py
bin/tests/system/fetchlimit/tests_sh_fetchlimit.py
bin/tests/system/forward/tests_sh_forward.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/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 ca80734d4d7c302bcce4e83506c2c6314ca2cf76..6c318c9936cef1df36e59b0b113a388859f3d87c 100644 (file)
@@ -16,6 +16,9 @@ import pytest
 import isctest
 from isctest.util import param
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 1471ad0ca295378a0645d041e80ba843da8d0b7c..ae7050e02e6fec543b327eeb6fe88de5186eab81 100644 (file)
@@ -9,10 +9,14 @@
 # See the COPYRIGHT file distributed with this work for additional
 # information regarding copyright ownership.
 
+import pytest
 from dns import flags
 
 import isctest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 def bootstrap():
     return {
index cb137b26ab1bc9b917f5f516cd708d37eccbd0c0..473c4479722419b18c53a05b27605bfe0d8da9d8 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 bootstrap():
index 61ab35a7ac6974191f876ebcf0c197ef0f32d0fd..aa374584bacdff253d2ddf874dc42135ff6eca77 100644 (file)
@@ -17,6 +17,9 @@ import pytest
 
 import isctest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index f32406def42bfd73200c565e595dbe9221912494..672dc8a4a45cd41ecdaf74b174e24cc8014832dc 100644 (file)
@@ -18,6 +18,9 @@ import pytest
 
 import isctest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 48e7891ca34f97e23a1d1c438ae5ea7c3886af0f..609f110c5985449fece47f889bab3161d9fa0f8f 100644 (file)
@@ -18,6 +18,9 @@ import pytest
 
 import isctest
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 pytestmark = pytest.mark.extra_artifacts(
     [
index 338f7f4e71c7cbc9f0683f29c1b096c2e9a5a0e9..e6d8ccc7343362dbd1aa5a9133d1917f23a39268 100644 (file)
@@ -22,8 +22,9 @@ import isctest
 import isctest.mark
 from isctest.util import param
 
-
+# isctest.asyncserver requires dnspython >= 2.0.0
 pytest.importorskip("dns", minversion="2.0.0")
+
 pytestmark = pytest.mark.extra_artifacts(
     [
         "*/K*",
index 72999a8623cb3c0910bce3161ee3f5d4f999564d..51283aedf9dc74b9f25a99322b711c7071478e1c 100644 (file)
@@ -13,6 +13,11 @@ from dns import flags
 
 import isctest
 
+import pytest
+
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 def bootstrap():
     return {
index 7cf6e8edbbb04f9b13f21216cbb210a645ff055f..e6079e4b5a374cf4c0197bf23b36adea7154ba9c 100644 (file)
@@ -14,6 +14,11 @@ import shutil
 
 import isctest
 
+import pytest
+
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 def bootstrap():
     assert not os.path.exists("ns4/managed-keys.bind.jnl")
index 29b771dcbd6380227dad642a62da4aaa540f21e5..90b071ec584db69121007f1aff1b770a7539c828 100644 (file)
@@ -16,6 +16,9 @@ import pytest
 import isctest
 from isctest.util import param
 
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 def bootstrap():
     return {
index 7c243e90ef55cfb68fd36558a8dfe7c87778955e..085f388b2c9092bd04ffa245ff34a956ccfacc9e 100644 (file)
@@ -14,6 +14,11 @@ import re
 
 import isctest
 
+import pytest
+
+# isctest.asyncserver requires dnspython >= 2.0.0
+pytest.importorskip("dns", minversion="2.0.0")
+
 
 def bootstrap():
     return {
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 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 2159a6a7dc92d2e30635bbbe01df5f5f237a7da1..e91d9e5206fad202a5d432eeeafa18bfe6b4705e 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 48d403074004d079065d34fab02b5c785d582cf6..e34dd437a85b53fdce261e80314921f78d4b8933 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*",