]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
tests-extra: when ports are busy, really allow a retry with a different configuration
authorDavid Vašek <david.vasek@nic.cz>
Sat, 17 May 2025 10:34:15 +0000 (12:34 +0200)
committerDaniel Salzman <daniel.salzman@nic.cz>
Mon, 2 Jun 2025 06:37:59 +0000 (08:37 +0200)
tests-extra/tools/dnstest/server.py
tests-extra/tools/dnstest/test.py

index 4f8512fbe5ae9ec5fa261cf473e68de81c878675..93b290202fa001a9b3d3e1905fae7b9462fef818 100644 (file)
@@ -369,7 +369,7 @@ class Server(object):
         if Context().test.stress and self.inquirer:
             self.inquirer.start(self)
 
-    def start(self, clean=False):
+    def start(self, clean=False, fatal=True):
         '''Start the server with all bindings successful'''
 
         for attempt in range(Server.START_MAX_ATTEMPTS):
@@ -384,7 +384,10 @@ class Server(object):
                 time.sleep(Server.START_WAIT_ATTEMPTS)
                 check_log("STARTING %s AGAIN" % self.name)
 
-        raise Failed("Couldn't bind all addresses or ports")
+        if fatal:
+            raise Failed("Server %s couldn't bind all addresses or ports" % self.name)
+        else:
+            check_log("BUSY PORTS, START OF %s FAILED" % self.name)
 
     def ctl(self, cmd, wait=False, availability=True, read_result=False):
         if availability:
@@ -1271,7 +1274,7 @@ class Bind(Server):
 
         return s.conf
 
-    def start(self, clean=False):
+    def start(self, clean=False, fatal=True):
         for zname in self.zones:
             z = self.zones[zname]
             if z.dnssec.enable != True:
@@ -1303,7 +1306,7 @@ class Bind(Server):
                     #n3iters = z.dnssec.nsec3_iters or 0
                     #outf.write("%s NSEC3PARAM 1 %d %d -\n" % (z.name, n3flag, n3iters)) # this does not work!
 
-        super().start(clean)
+        super().start(clean, fatal)
 
         for zname in self.zones:
             z = self.zones[zname]
@@ -1935,7 +1938,7 @@ class Dummy(Server):
     def get_config(self):
         return ''
 
-    def start(self, clean=None):
+    def start(self, clean=None, fatal=None):
         return True
 
     def listening(self):
index 2f103da74f8d38109adb5a7682e8c40a911d3054..883948684b2b70a20d2f2804d73d2692ba52b861 100644 (file)
@@ -277,7 +277,7 @@ class Test(object):
             if server.external:
                 continue
 
-            server.start(clean=True)
+            server.start(clean=True, fatal=False)
 
             # When address/port is busy, Knot exits, BIND doesn't.
             if not server.running() or not server.listening():