From b89a4dbbd00ac75f1c00d61694d084b511e45408 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 14 Mar 2025 14:59:21 +0100 Subject: [PATCH] rec: allow file to not exist yet in test_RPZ.py --- regression-tests.recursor-dnssec/test_RPZ.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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)) -- 2.47.2