]> git.ipfire.org Git - thirdparty/knot-dns.git/commitdiff
tests-extra: limit the number of DDNS tries in random_ddns()
authorDavid Vašek <david.vasek@nic.cz>
Wed, 21 Dec 2022 23:54:09 +0000 (00:54 +0100)
committerDaniel Salzman <daniel.salzman@nic.cz>
Mon, 30 Jan 2023 08:58:23 +0000 (09:58 +0100)
tests-extra/tools/dnstest/server.py

index d71bf4b894b6a8961c0942c392a8397d265bbeac..67af0ddb351cf2995b2690b5af27682b24c98ed2 100644 (file)
@@ -879,10 +879,10 @@ class Server(object):
         else:
             self.zones[zone.name].zfile.upd_file(storage=storage, version=version)
 
-    def random_ddns(self, zone, allow_empty=True):
+    def random_ddns(self, zone, allow_empty=True, tries=20):
         zone = zone_arg_check(zone)
 
-        while True:
+        for i in range(tries):
             up = self.update(zone)
 
             while True:
@@ -891,7 +891,9 @@ class Server(object):
                     break
 
             if up.try_send() == "NOERROR":
-                break
+                return
+
+        raise Failed("Can't send DDNS update of zone '%s' to server '%s'" % (zone.name, self.name))
 
     def add_module(self, zone, module):
         zone = zone_arg_check(zone)