mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 21:33:02 +02:00
test: mdns_allow_deny: Adapt to yangerd behaviour changes
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user