From: Otto Moerbeek Date: Fri, 21 Feb 2025 11:07:41 +0000 (+0100) Subject: rec: workaround a potential (but rare) race in the FWCatz test X-Git-Tag: dnsdist-2.0.0-alpha1~62^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F15206%2Fhead;p=thirdparty%2Fpdns.git rec: workaround a potential (but rare) race in the FWCatz test --- diff --git a/regression-tests.recursor-dnssec/test_FWCatz.py b/regression-tests.recursor-dnssec/test_FWCatz.py index f995d8f4a9..e8768bb7e8 100644 --- a/regression-tests.recursor-dnssec/test_FWCatz.py +++ b/regression-tests.recursor-dnssec/test_FWCatz.py @@ -287,9 +287,22 @@ recursor: self.assertEqual(res.question[0].to_text(), 'forward.catz. IN SOA') def checkForwards(self, expected): - with open('configs/' + self._confdir + '/catzone.forward.catz.') as file: - reality = yaml.safe_load(file); - self.assertEqual(expected, reality) + attempts = 0 + tries = 10 + ex = None + while attempts < tries: + try: + with open('configs/' + self._confdir + '/catzone.forward.catz.') as file: + reality = yaml.safe_load(file); + if expected == reality: + return + except Exception as e: + ex = e + attempts = attempts + 1 + sleep(0.1) + if ex is not None: + raise ex + raise AssertionError('expected content not found') def waitUntilCorrectSerialIsLoaded(self, serial, timeout=5): global fwCatzServer