diff --git a/test/case/services/mdns/mdns_allow_deny/test.py b/test/case/services/mdns/mdns_allow_deny/test.py index 0311d916..985ba0df 100755 --- a/test/case/services/mdns/mdns_allow_deny/test.py +++ b/test/case/services/mdns/mdns_allow_deny/test.py @@ -12,6 +12,7 @@ with three scenarios: """ import re import infamy +from infamy.util import until def mdns_scan(): @@ -56,9 +57,17 @@ def check(expected, allow=None, deny=None): dut.put_config_dicts({"infix-services": mdns_config}) - actual = mdns_scan() - if actual != tuple(expected): - raise AssertionError(f"Expected {expected}, got {actual}") + # The mDNS daemon is restarted/reloaded asynchronously when the + # allow/deny config changes, so retry the scan until the observed + # per-interface result matches the expectation. until() re-raises the + # last AssertionError on timeout, preserving the expected/got detail. + def scan_matches(): + actual = mdns_scan() + if actual != tuple(expected): + raise AssertionError(f"Expected {expected}, got {actual}") + return True + + until(scan_matches, attempts=20) with infamy.Test() as test: