From 8225a9432958da4890449606abf2c443670734f1 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 21 Feb 2025 12:07:41 +0100 Subject: [PATCH] rec: workaround a potential (but rare) race in the FWCatz test --- .../test_FWCatz.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) 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 -- 2.47.2