]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Tests with special auth working now
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 18 Feb 2026 13:00:48 +0000 (14:00 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 18 Feb 2026 14:02:39 +0000 (15:02 +0100)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
regression-tests.recursor-dnssec/recursortests.py
regression-tests.recursor-dnssec/test_AggressiveNSECCache.py
regression-tests.recursor-dnssec/test_Expired.py
regression-tests.recursor-dnssec/test_NotYetValid.py
regression-tests.recursor-dnssec/test_RecDnstap.py
regression-tests.recursor-dnssec/test_SimpleCookies.py

index c2aaac7834f30ac661a09cfe0756406e6b56142a..fbd78c086f554e2bcc6ec80390787dbc2f77b55e 100644 (file)
@@ -490,7 +490,7 @@ options {
     @classmethod
     def generateAuthConfig(cls, confdir, threads, extra=''):
         bind_dnssec_db = os.path.join(confdir, 'bind-dnssec.sqlite3')
-
+        print('writing to ' + os.path.join(confdir, 'pdns.conf'))
         with open(os.path.join(confdir, 'pdns.conf'), 'w') as pdnsconf:
             pdnsconf.write("""
 module-dir={moduledir}
@@ -563,7 +563,7 @@ distributor-threads={threads}
                 authconfdir = os.path.join(confdir, 'auth-%s' % auth_suffix)
 
                 os.mkdir(authconfdir)
-
+                print(authconfdir)
                 cls.generateAuthConfig(authconfdir, threads)
                 cls.generateAuthNamedConf(authconfdir, zones)
 
@@ -574,6 +574,17 @@ distributor-threads={threads}
                     if cls._zone_keys.get(zone, None):
                         cls.secureZone(authconfdir, zone, cls._zone_keys.get(zone))
 
+    @classmethod
+    def setUpClassSpecialAuths(cls):
+        # tear down existing auths, and start with our own special config
+        confdir = os.path.join('configs', 'auths')
+        cls.tearDownAuth()
+        #confdir = os.path.join('configs', cls._confdir)
+        print("Specialized auth setup" + confdir)
+        cls.createConfigDir(confdir)
+        cls.generateAllAuthConfig(confdir)
+        cls.startAllAuth(confdir)
+
     @classmethod
     def startAllAuth(cls, confdir):
         if cls._auth_zones:
@@ -793,26 +804,27 @@ distributor-threads={threads}
         print("Launching tests..")
 
     @classmethod
-    def tearDownClass(cls):
+    def tearDownClass(cls, withAuths=False):
         rec = None
-        #auth = None
+        auth = None
         resp = None
         try:
             cls.tearDownRecursor()
         except BaseException as e:
             rec = e
-        #try:
-        #    cls.tearDownAuth()
-        #except BaseException as e:
-        #    auth = e
+        try:
+            if withAuths:
+                cls.tearDownAuth()
+        except BaseException as e:
+            auth = e
         try:
             cls.tearDownResponders()
         except BaseException as e:
             resp = e
         if rec is not None:
             raise rec
-        #if auth is not None:
-        #    raise auth
+        if auth is not None:
+            raise auth
         if resp is not None:
             raise resp
 
@@ -1474,3 +1486,5 @@ class ResponderDropAction(object):
     An object to indicate a drop action shall be taken
     """
     pass
+
+
index d718cfbf40ff43abcd44f986d4a8a3db48b0b1ec..03aa04eea519ab6d13664cc05085e4879fc2d596 100644 (file)
@@ -5,6 +5,7 @@ import requests
 import subprocess
 import extendederrors
 import pytest
+import shutil
 
 class AggressiveNSECCacheBase(RecursorTest):
     __test__ = False
@@ -236,11 +237,29 @@ class AggressiveNSECCacheNSECTest(AggressiveNSECCacheBase):
         self.assertEqual(res.options[0].otype, 15)
         self.assertEqual(res.options[0], extendederrors.ExtendedErrorOption(9, b''))
 
-@pytest.mark.skip(reason="changes auth config")
 class AggressiveNSECCacheNSEC3Test(AggressiveNSECCacheBase):
     _confdir = 'AggressiveNSECCacheNSEC3'
     __test__ = True
 
+    @classmethod
+    def setUpClass(cls):
+        cls.setUpClassSpecialAuths()
+        super().setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        confdir = os.path.join('configs', cls._confdir)
+        print("Specialized auth teardown " + confdir)
+        # tear down specialized auths, and then start standard ones
+        super().tearDownClass(True)
+        print("Starting default auths")
+        confdir = 'configs/auths'
+        shutil.rmtree(confdir, True)
+        os.mkdir(confdir)
+        # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+        RecursorTest.generateAllAuthConfig(confdir)
+        RecursorTest.startAllAuth(confdir)
+
     @classmethod
     def secureZone(cls, confdir, zonename, key=None):
         zone = '.' if zonename == 'ROOT' else zonename
index af2a39adc26dafdccd268a4d76c88ed5d3472ff6..95dad2ce0e49b7a5b1367c73f0bf0b34730f0867 100644 (file)
@@ -3,10 +3,9 @@ import os
 import dns
 import extendederrors
 import pytest
+import shutil
 from recursortests import RecursorTest
 
-
-@pytest.mark.skip(reason="changes auth config")
 class ExpiredTest(RecursorTest):
     """This regression test starts the authoritative servers with a clock that is
     set 15 days into the past. Hence, the recursor must reject the signatures
@@ -20,13 +19,31 @@ class ExpiredTest(RecursorTest):
     _auth_env = {'LD_PRELOAD':os.environ.get('LIBFAKETIME'),
                  'FAKETIME':'-15d'}
 
+    @classmethod
+    def setUpClass(cls):
+        cls.setUpClassSpecialAuths()
+        super().setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        confdir = os.path.join('configs', 'auths')
+        print("Specialized auth teardown " + confdir)
+        # tear down specialized auths, and then start standard ones
+        super().tearDownClass(True)
+        print("Starting default auths")
+        #confdir = 'configs/auths'
+        shutil.rmtree(confdir, True)
+        os.mkdir(confdir)
+        # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+        RecursorTest.generateAllAuthConfig(confdir)
+        RecursorTest.startAllAuth(confdir)
+
     def testA(self):
         query = dns.message.make_query('host1.secure.example', 'A')
         res = self.sendUDPQuery(query)
 
         self.assertRcodeEqual(res, dns.rcode.SERVFAIL)
 
-@pytest.mark.skip(reason="changes auth config")
 class ExpiredWithEDETest(RecursorTest):
     """This regression test starts the authoritative servers with a clock that is
     set 15 days into the past. Hence, the recursor must reject the signatures
@@ -42,6 +59,24 @@ class ExpiredWithEDETest(RecursorTest):
 
     _auth_env = {'LD_PRELOAD':os.environ.get('LIBFAKETIME'),
                  'FAKETIME':'-15d'}
+    @classmethod
+    def setUpClass(cls):
+        cls.setUpClassSpecialAuths()
+        super().setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        confdir = os.path.join('configs', 'auths')
+        print("Specialized auth teardown " + confdir)
+        # tear down specialized auths, and then start standard ones
+        super().tearDownClass(True)
+        print("Starting default auths")
+        #confdir = 'configs/auths'
+        shutil.rmtree(confdir, True)
+        os.mkdir(confdir)
+        # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+        RecursorTest.generateAllAuthConfig(confdir)
+        RecursorTest.startAllAuth(confdir)
 
     def testA(self):
         qname = 'host1.secure.example'
index 0abbd3c2ac9622bff68ac7643aae7490b2737247..4a57b4c3cbd21020f92e706c8f52eb3c67cce316 100644 (file)
@@ -1,10 +1,10 @@
 import os
 import dns
 import pytest
+import shutil
 from recursortests import RecursorTest
 
 
-@pytest.mark.skip(reason="changes auth config")
 class NotYetValidTest(RecursorTest):
     """This regression test starts the authoritative servers with a clock that is
     set 15 days into the future. Hence, the recursor must reject the signatures
@@ -17,6 +17,25 @@ class NotYetValidTest(RecursorTest):
     _auth_env = {'LD_PRELOAD':os.environ.get('LIBFAKETIME'),
                  'FAKETIME':'+15d'}
 
+    @classmethod
+    def setUpClass(cls):
+        cls.setUpClassSpecialAuths()
+        super().setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        confdir = os.path.join('configs', 'auths')
+        print("Specialized auth teardown " + confdir)
+        # tear down specialized auths, and then start standard ones
+        super().tearDownClass(True)
+        print("Starting default auths")
+        #confdir = 'configs/auths'
+        shutil.rmtree(confdir, True)
+        os.mkdir(confdir)
+        # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+        RecursorTest.generateAllAuthConfig(confdir)
+        RecursorTest.startAllAuth(confdir)
+
     def testA(self):
         query = dns.message.make_query('host1.secure.example', 'A')
         res = self.sendUDPQuery(query)
index 0a3f690ad5e3521936b01972745fc463467b757b..bb9e1e5d8503afc33ec23e9d0f5a870ed6b1d1bd 100644 (file)
@@ -8,6 +8,7 @@ import time
 import dns
 import dnstap_pb2
 import pytest
+import traceback
 from recursortests import RecursorTest
 
 FSTRM_CONTROL_ACCEPT = 0x01
@@ -129,7 +130,7 @@ def fstrm_make_control_frame_reply(cft):
     elif cft == FSTRM_CONTROL_START:
         return None
     else:
-        raise Exception('unhandled control frame ' + cft)
+        raise Exception('unhandled control frame ' + str(cft))
 
 
 def fstrm_read_and_dispatch_control_frame(conn):
index 06327f74bd6c5144d6c6d40863cf7bd347579f9c..9cd92594d2c14c24e3c896ed2e6f014d8262682a 100644 (file)
@@ -1,9 +1,9 @@
 import dns
 import os
 import pytest
+import shutil
 from recursortests import RecursorTest
 
-@pytest.mark.skip(reason="changes auth config")
 class SimpleCookiesTest(RecursorTest):
     _confdir = 'SimpleCookies'
     _auth_zones = RecursorTest._default_auth_zones
@@ -143,3 +143,21 @@ class SimpleCookiesAuthEnabledTest(SimpleCookiesTest):
     def generateAuthConfig(cls, confdir, threads):
         super(SimpleCookiesAuthEnabledTest, cls).generateAuthConfig(confdir, threads, "edns-cookie-secret=01234567890123456789012345678901")
 
+    @classmethod
+    def setUpClass(cls):
+        cls.setUpClassSpecialAuths()
+        super().setUpClass()
+
+    @classmethod
+    def tearDownClass(cls):
+        confdir = os.path.join('configs', 'auths')
+        print("Specialized auth teardown " + confdir)
+        # tear down specialized auths, and then start standard ones
+        super().tearDownClass(True)
+        print("Starting default auths")
+        #confdir = 'configs/auths'
+        shutil.rmtree(confdir, True)
+        os.mkdir(confdir)
+        # Be careful here, we don't want the overridden secureZone(), so call RecursorTest explicitly
+        RecursorTest.generateAllAuthConfig(confdir)
+        RecursorTest.startAllAuth(confdir)