[9.20] fix: test: Allow re-run of kasp test case on all FreeBSDs

Closes #5720

Backport of MR !11507

Merge branch 'backport-5720-freebsd-kasp-test-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!11531
This commit is contained in:
Nicki Křížek 2026-02-06 15:37:30 +01:00
commit 2b00f34800
3 changed files with 10 additions and 2 deletions

View file

@ -43,6 +43,10 @@ def is_dnsrps_available():
return True
def is_host_freebsd(*_):
return platform.system() == "FreeBSD"
def is_host_freebsd_13(*_):
return platform.system() == "FreeBSD" and platform.release().startswith("13")

View file

@ -142,13 +142,17 @@ def perl(script: str, args: Optional[List[str]] = None) -> None:
def retry_with_timeout(func, timeout, delay=1, msg=None):
start_time = time.monotonic()
exc_msg = None
fname = f"{func.__module__}.{func.__qualname__}()"
while time.monotonic() < start_time + timeout:
exc_msg = None
isctest.log.debug(f"retry_with_timeout: {fname} called")
try:
if func():
isctest.log.debug(f"retry_with_timeout: {fname} succeeded")
return
except AssertionError as exc:
exc_msg = str(exc)
isctest.log.debug(f"retry_with_timeout: {fname} failed, sleep {delay}s")
time.sleep(delay)
if exc_msg is not None:
isctest.log.error(exc_msg)
@ -156,7 +160,7 @@ def retry_with_timeout(func, timeout, delay=1, msg=None):
if exc_msg is not None:
msg = exc_msg
else:
msg = f"{func.__module__}.{func.__qualname__} timed out after {timeout} s"
msg = f"{fname} timed out after {timeout} s"
assert False, msg

View file

@ -596,7 +596,7 @@ def cb_remove_keyfiles(params, ksks=None, zsks=None):
},
id="secondary.kasp",
marks=pytest.mark.flaky(
max_runs=2, rerun_filter=isctest.mark.is_host_freebsd_13
max_runs=2, rerun_filter=isctest.mark.is_host_freebsd
),
),
pytest.param(