diff options
author | Daniel Salzman <daniel.salzman@nic.cz> | 2024-12-28 10:18:55 +0100 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2024-12-28 10:18:55 +0100 |
commit | 73f7d5ba42584d6b80edef6e1d709098a46109ed (patch) | |
tree | a57322c13f75e4a799aced0468417703af30e6f8 | |
parent | libngtcp2: update embedded libngtcp2 to v1.10.0 (diff) | |
parent | tests-extra: remove superfluous C-style semicolons from Python code (diff) | |
download | knot-73f7d5ba42584d6b80edef6e1d709098a46109ed.tar.xz knot-73f7d5ba42584d6b80edef6e1d709098a46109ed.zip |
Merge branch 'tests_socket_starting' into 'master'
Fix the servers startup in the functional tests.
See merge request knot/knot-dns!1736
19 files changed, 51 insertions, 48 deletions
diff --git a/tests-extra/tests/dnssec/dnskey_timestamps/test.py b/tests-extra/tests/dnssec/dnskey_timestamps/test.py index c79e8bbe4..5429a70bf 100644 --- a/tests-extra/tests/dnssec/dnskey_timestamps/test.py +++ b/tests-extra/tests/dnssec/dnskey_timestamps/test.py @@ -20,7 +20,7 @@ def check_zone(server, expect_dnskey, expect_rrsig, msg): expect_rrsigs = 2 if expect_rrsig else 1 check_log("DNSKEYs: %d (expected %d) RRSIGs: %d (expected %d)" % - (found_dnskeys, expect_dnskeys, found_rrsigs, expect_rrsigs)); + (found_dnskeys, expect_dnskeys, found_rrsigs, expect_rrsigs)) if found_dnskeys != expect_dnskeys or found_rrsigs != expect_rrsigs: set_err("BAD DNSKEY: " + msg) diff --git a/tests-extra/tests/dnssec/ds_push/test.py b/tests-extra/tests/dnssec/ds_push/test.py index 6663e9534..66514c003 100644 --- a/tests-extra/tests/dnssec/ds_push/test.py +++ b/tests-extra/tests/dnssec/ds_push/test.py @@ -34,10 +34,10 @@ def check_zone(server, zone, dnskeys, dnskey_rrsigs, cdnskeys, soa_rrsigs, msg): qsoa = server.dig(zone.name, "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); - check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) + check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/ds_query/test.py b/tests-extra/tests/dnssec/ds_query/test.py index 401334578..651d677f0 100644 --- a/tests-extra/tests/dnssec/ds_query/test.py +++ b/tests-extra/tests/dnssec/ds_query/test.py @@ -22,10 +22,10 @@ def check_zone(server, zone, dnskeys, dnskey_rrsigs, cdnskeys, soa_rrsigs, msg): qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); - check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) + check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/key_rollovers/test.py b/tests-extra/tests/dnssec/key_rollovers/test.py index e434082bd..f1337450e 100644 --- a/tests-extra/tests/dnssec/key_rollovers/test.py +++ b/tests-extra/tests/dnssec/key_rollovers/test.py @@ -62,10 +62,10 @@ def check_zone(server, zone, slave, dnskeys, dnskey_rrsigs, cdnskeys, soa_rrsigs qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); - check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) + check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/keytag_conflict/test.py b/tests-extra/tests/dnssec/keytag_conflict/test.py index 41c0ae811..2fcbfc881 100644 --- a/tests-extra/tests/dnssec/keytag_conflict/test.py +++ b/tests-extra/tests/dnssec/keytag_conflict/test.py @@ -22,8 +22,8 @@ def check_zone4(server, min_dnskeys, min_rrsigs, msg): soa = server.dig("mail." + ZONE, "A", dnssec=True) found_rrsigs = soa.count("RRSIG") - check_log("RRSIGs: %d (expected min %d)" % (found_rrsigs, min_rrsigs)); - check_log("DNSKEYs: %d (expected min %d)" % (found_dnskeys, min_dnskeys)); + check_log("RRSIGs: %d (expected min %d)" % (found_rrsigs, min_rrsigs)) + check_log("DNSKEYs: %d (expected min %d)" % (found_dnskeys, min_dnskeys)) if found_rrsigs < min_rrsigs: set_err("BAD RRSIG COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/ksk_rollover/test.py b/tests-extra/tests/dnssec/ksk_rollover/test.py index f1e3c4c13..e871d8a30 100644 --- a/tests-extra/tests/dnssec/ksk_rollover/test.py +++ b/tests-extra/tests/dnssec/ksk_rollover/test.py @@ -25,10 +25,10 @@ def check_zone(server, zone, slave, dnskeys, dnskey_rrsigs, cdnskeys, soa_rrsigs qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); - check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) + check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/nsec3_opt_out/test.py b/tests-extra/tests/dnssec/nsec3_opt_out/test.py index 12baa3761..22bbe1ef9 100644 --- a/tests-extra/tests/dnssec/nsec3_opt_out/test.py +++ b/tests-extra/tests/dnssec/nsec3_opt_out/test.py @@ -23,7 +23,7 @@ def check_deleg(deleg, nsec3_bitmap, opt_out_flag, msg): if first_bitmap != nsec3_bitmap: set_err("NSEC3 bitmap for '%s'" % msg) - first_flags = first_nsec3.split()[5]; + first_flags = first_nsec3.split()[5] if first_flags != str(opt_out_flag): set_err("NSEC3 opt-out flag %s != %s for '%s'" % (first_flags, str(opt_out_flag), msg)) diff --git a/tests-extra/tests/dnssec/offline_ksk/test.py b/tests-extra/tests/dnssec/offline_ksk/test.py index e8b08d685..808ea5e79 100644 --- a/tests-extra/tests/dnssec/offline_ksk/test.py +++ b/tests-extra/tests/dnssec/offline_ksk/test.py @@ -40,9 +40,9 @@ def check_zone(server, zone, dnskeys, dnskey_rrsigs, soa_rrsigs, msg): qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/offline_ksk2/test.py b/tests-extra/tests/dnssec/offline_ksk2/test.py index 587e5435e..62186bb90 100644 --- a/tests-extra/tests/dnssec/offline_ksk2/test.py +++ b/tests-extra/tests/dnssec/offline_ksk2/test.py @@ -21,9 +21,9 @@ def check_zone(server, zone, dnskeys, dnskey_rrsigs, soa_rrsigs, msg): qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) diff --git a/tests-extra/tests/dnssec/on_slave_signing/test.py b/tests-extra/tests/dnssec/on_slave_signing/test.py index 853139255..ef5d6f29b 100644 --- a/tests-extra/tests/dnssec/on_slave_signing/test.py +++ b/tests-extra/tests/dnssec/on_slave_signing/test.py @@ -50,8 +50,8 @@ def test_one(master, slave, zone, master_policy, slave_policy, initial_serial, slave.stop() server_purge(slave, zone) master.zones[zone[0].name].zfile.update_soa(serial=initial_serial) - master.serial_policy = master_policy; - slave.serial_policy = slave_policy; + master.serial_policy = master_policy + slave.serial_policy = slave_policy master.gen_confile() slave.gen_confile() master.start() diff --git a/tests-extra/tests/journal/serial_arithmetic/test.py b/tests-extra/tests/journal/serial_arithmetic/test.py index abbe2c0a9..17157915d 100644 --- a/tests-extra/tests/journal/serial_arithmetic/test.py +++ b/tests-extra/tests/journal/serial_arithmetic/test.py @@ -67,7 +67,7 @@ for i in range(1, 6): fix = 0 if i == 5: # Invalid serial change - zone unchanged - fix = 1; + fix = 1 t.sleep(1) previous = dict() diff --git a/tests-extra/tests/modules/cookies/test.py b/tests-extra/tests/modules/cookies/test.py index 1f86ab59e..8f5c7ee97 100644 --- a/tests-extra/tests/modules/cookies/test.py +++ b/tests-extra/tests/modules/cookies/test.py @@ -98,17 +98,17 @@ response = check_rcode(knot, query, rcodeNoerror, "CORRECT COOKIE 2") reconfigure(knot, zone, 4, secret_lifetime=1000000) cookieOpt = dns.edns.option_from_wire(cookieOpcode, clientCookie, 0, clientCookieLen) -query = dns.message.make_query("dns1.example.com", "A", use_edns=True, options=[cookieOpt]); +query = dns.message.make_query("dns1.example.com", "A", use_edns=True, options=[cookieOpt]) response = check_rcode(knot, query, rcodeBadcookie, "ONLY CLIENT COOKIE 2") # Next 3 attempts to get the server cookie should timeout for i in range(3): - query = dns.message.make_query("dns1.example.com", "A", use_edns=True, options=[cookieOpt]); + query = dns.message.make_query("dns1.example.com", "A", use_edns=True, options=[cookieOpt]) response = check_rcode(knot, query, rcodeNoerror, "TIMEOUT "+str(i)) compare(response, None, "BADCOOKIE TIMEOUT " + str(i)) # The 4th attempt should succeed -query = dns.message.make_query("dns1.example.com", "A", use_edns=True, options=[cookieOpt]); +query = dns.message.make_query("dns1.example.com", "A", use_edns=True, options=[cookieOpt]) check_rcode(knot, query, rcodeBadcookie, "BADCOOKIE") ## Fixed secret(s) diff --git a/tests-extra/tests/modules/dnsproxy/test.py b/tests-extra/tests/modules/dnsproxy/test.py index f6e9e9dbe..4a8a867a3 100644 --- a/tests-extra/tests/modules/dnsproxy/test.py +++ b/tests-extra/tests/modules/dnsproxy/test.py @@ -22,11 +22,11 @@ zone_common2 = t.zone("test", storage=".", file_name="test.remote_zone") while True: zone_local = t.zone_rnd(1) if not is_subzone(zone_local[0], zone_common1[0]): - break; + break while True: zone_remote = t.zone_rnd(1) if not is_subzone(zone_remote[0], zone_common2[0]): - break; + break local = t.server("knot", tsig=TSIG) t.link(zone_common1, local) diff --git a/tests-extra/tests/modules/geoip/test.py b/tests-extra/tests/modules/geoip/test.py index 4f351bb6a..1f3bcf776 100644 --- a/tests-extra/tests/modules/geoip/test.py +++ b/tests-extra/tests/modules/geoip/test.py @@ -29,7 +29,7 @@ iso_codes = ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', 'AM', 'AO', 'AQ', 'AR', 'AS', ' 'SM', 'SN', 'SO', 'SR', 'SS', 'ST', 'SV', 'SX', 'SY', 'SZ', 'TC', 'TD', 'TF', 'TG', 'TH', 'TJ', 'TK', 'TL', 'TM', 'TN', 'TO', 'TR', 'TT', 'TV', 'TW', 'TZ', 'UA', 'UG', 'UM', 'US', 'UY', 'UZ', 'VA', 'VC', 'VE', 'VG', - 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW']; + 'VI', 'VN', 'VU', 'WF', 'WS', 'YE', 'YT', 'ZA', 'ZM', 'ZW'] RELOAD_OVERWRITE = random.choice([False, True]) @@ -77,7 +77,7 @@ mod_geoip = ModGeoip(geodb_filename, "geodb", t.data_dir + "db.mmdb", ["country/iso_code", "(id)city/geoname_id"]) mod_subnet = ModGeoip(subnet_filename) -knot.add_module(zone, mod_geoip); +knot.add_module(zone, mod_geoip) t.start() @@ -105,7 +105,7 @@ for i in range(1, 1000): # Restart with subnet module. knot.clear_modules(zone) -knot.add_module(zone, mod_subnet); +knot.add_module(zone, mod_subnet) knot.gen_confile() knot.reload() knot.zone_wait(zone) diff --git a/tests-extra/tests/modules/onlinesign_rollovers/test.py b/tests-extra/tests/modules/onlinesign_rollovers/test.py index 6b91c00da..2e49fa0b3 100644 --- a/tests-extra/tests/modules/onlinesign_rollovers/test.py +++ b/tests-extra/tests/modules/onlinesign_rollovers/test.py @@ -34,10 +34,10 @@ def check_zone(server, zone, dnskeys, dnskey_rrsigs, cdnskeys, soa_rrsigs, msg): qsoa = server.dig("example.com", "SOA", dnssec=True, bufsize=4096) found_soa_rrsigs = qsoa.count("RRSIG") - check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)); - check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)); - check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)); - check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)); + check_log("DNSKEYs: %d (expected %d)" % (found_dnskeys, dnskeys)) + check_log("RRSIGs: %d (expected %d)" % (found_soa_rrsigs, soa_rrsigs)) + check_log("DNSKEY-RRSIGs: %d (expected %d)" % (found_rrsigs, dnskey_rrsigs)) + check_log("CDNSKEYs: %d (expected %d)" % (found_cdnskeys, cdnskeys)) if found_dnskeys != dnskeys: set_err("BAD DNSKEY COUNT: " + msg) @@ -96,7 +96,7 @@ def wait_for_cds_change(t, server, timeout): def watch_alg_rollover(t, server, zone, before_keys, after_keys, desc, set_alg, key_len, submission_cb): check_zone(server, zone, before_keys, 1, 1, 1, desc + ": initial keys") - z = server.zones[zone[0].name]; + z = server.zones[zone[0].name] z.get_module("onlinesign").algorithm = set_alg z.get_module("onlinesign").key_size = key_len server.gen_confile() @@ -128,7 +128,7 @@ def watch_alg_rollover(t, server, zone, before_keys, after_keys, desc, set_alg, def watch_ksk_rollover(t, server, zone, before_keys, after_keys, total_keys, desc, set_ksk_lifetime, submission_cb): check_zone(server, zone, before_keys, 1, 1, 1, desc + ": initial keys") - z = server.zones[zone[0].name]; + z = server.zones[zone[0].name] orig_ksk_lifetime = z.get_module("onlinesign").ksk_life z.get_module("onlinesign").ksk_life = set_ksk_lifetime if set_ksk_lifetime > 0 else orig_ksk_lifetime diff --git a/tests-extra/tests/modules/stats/test.py b/tests-extra/tests/modules/stats/test.py index 58b9732b4..0c3c0fb21 100644 --- a/tests-extra/tests/modules/stats/test.py +++ b/tests-extra/tests/modules/stats/test.py @@ -125,7 +125,7 @@ for size in [query_size1, query_size2, query_size3]: if idx not in indices: indices[idx] = 1 else: - indices[idx] += 1; + indices[idx] += 1 for size in indices: check_item(knot, "mod-stats", "query-size", indices[size], idx=size) @@ -136,7 +136,7 @@ for size in [reply_size1, reply_size2, reply_size3]: if idx not in indices: indices[idx] = 1 else: - indices[idx] += 1; + indices[idx] += 1 for size in indices: check_item(knot, "mod-stats", "reply-size", indices[size], idx=size) diff --git a/tests-extra/tests/zone/zonemd_flush/test.py b/tests-extra/tests/zone/zonemd_flush/test.py index 425b259b1..81fb2033e 100644 --- a/tests-extra/tests/zone/zonemd_flush/test.py +++ b/tests-extra/tests/zone/zonemd_flush/test.py @@ -55,7 +55,7 @@ def check_serial_incr(server, zones, serials, expect_incr, msg): new_serials = server.zones_wait(zones, serials) for z in zones: if new_serials[z.name] != serials[z.name] + expect_incr: - err_str = "%s: zone %s serial incremented by %d" % (msg, z.name, new_serials[z.name] - serial[z.name]); + err_str = "%s: zone %s serial incremented by %d" % (msg, z.name, new_serials[z.name] - serial[z.name]) detail_log(err_str) set_err(err_str) serials[z.name] = new_serials[z.name] diff --git a/tests-extra/tools/dnstest/server.py b/tests-extra/tools/dnstest/server.py index 04b46401b..59cd7f4dd 100644 --- a/tests-extra/tools/dnstest/server.py +++ b/tests-extra/tools/dnstest/server.py @@ -122,7 +122,7 @@ class Zone(object): def get_module(self, mod_name): for m in self.modules: if m.mod_name == mod_name: - return m; + return m def clear_modules(self): self.modules.clear() @@ -232,9 +232,11 @@ class Server(object): def _check_socket(self, proto, port): if self.addr.startswith("/"): + ux_socket = True param = "" iface = self.addr else: + ux_socket = False param = "-i" if ipaddress.ip_address(self.addr).version == 4: iface = "4%s@%s:%i" % (proto, self.addr, port) @@ -254,7 +256,7 @@ class Server(object): pids = list(set(pids)) # Check for successful bind. - if len(pids) == 1 and str(self.proc.pid) in pids: + if (ux_socket or len(pids) == 1) and str(self.proc.pid) in pids: return True time.sleep(2) diff --git a/tests-extra/tools/dnstest/test.py b/tests-extra/tools/dnstest/test.py index 4144d196e..90ca1f9e3 100644 --- a/tests-extra/tools/dnstest/test.py +++ b/tests-extra/tools/dnstest/test.py @@ -284,6 +284,7 @@ class Test(object): if not server.listening(): self.stop(kill=True) self.start() + break self.start_tries = 0 |