From: Otto Moerbeek Date: Fri, 14 Mar 2025 13:59:21 +0000 (+0100) Subject: rec: allow file to not exist yet in test_RPZ.py X-Git-Tag: dnsdist-2.0.0-alpha2~129^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b89a4dbbd00ac75f1c00d61694d084b511e45408;p=thirdparty%2Fpdns.git rec: allow file to not exist yet in test_RPZ.py --- diff --git a/regression-tests.recursor-dnssec/test_RPZ.py b/regression-tests.recursor-dnssec/test_RPZ.py index c72bae7632..25f3b00d8c 100644 --- a/regression-tests.recursor-dnssec/test_RPZ.py +++ b/regression-tests.recursor-dnssec/test_RPZ.py @@ -426,13 +426,16 @@ e 3600 IN A 192.0.2.42 incr = .1 # There's a file base race here, so do a few attempts while attempts < timeout: - zone = dns.zone.from_file(file, 'zone.rpz', relativize=False, check_origin=False, allow_include=False) - soa = zone[''] - rdataset = soa.find_rdataset(dns.rdataclass.IN, dns.rdatatype.SOA) - # if the above call did not throw an exception the SOA has the right owner, continue - soa = zone.get_soa() - if soa.serial == serial and soa.mname == dns.name.from_text('ns.zone.rpz.'): - return # we found what we expected + try: + zone = dns.zone.from_file(file, 'zone.rpz', relativize=False, check_origin=False, allow_include=False) + soa = zone[''] + rdataset = soa.find_rdataset(dns.rdataclass.IN, dns.rdatatype.SOA) + # if the above call did not throw an exception the SOA has the right owner, continue + soa = zone.get_soa() + if soa.serial == serial and soa.mname == dns.name.from_text('ns.zone.rpz.'): + return # we found what we expected + except e as FileNotFoundError: + pass attempts = attempts + incr time.sleep(incr) raise AssertionError("Waited %d seconds for the dumpfile to be updated to %d but the serial is still %d" % (timeout, serial, soa.serial))