diff --git a/test/case/interfaces/verify_all_interface_types/test.py b/test/case/interfaces/verify_all_interface_types/test.py index 46346d98..1a96a315 100755 --- a/test/case/interfaces/verify_all_interface_types/test.py +++ b/test/case/interfaces/verify_all_interface_types/test.py @@ -19,10 +19,10 @@ slightly longer than sending the entire configuration at once. import infamy import infamy.iface as iface - +from infamy.util import until def verify_interface(target, interface, expected_type): - assert iface.exist(target, interface), f"Interface <{interface}> does not exist." + until(lambda: iface.exist(target, interface)) expected_type = f"infix-if-type:{expected_type}" actual_type = iface.get_param(target, interface, "type") diff --git a/test/case/interfaces/veth_delete/test.py b/test/case/interfaces/veth_delete/test.py index 8bc1bd65..5993126e 100755 --- a/test/case/interfaces/veth_delete/test.py +++ b/test/case/interfaces/veth_delete/test.py @@ -13,7 +13,7 @@ from any other step. This to trigger a new configuration "generation". import infamy import infamy.iface as iface - +from infamy.util import until with infamy.Test() as test: with test.step("Set up topology and attach to target DUT"): @@ -51,10 +51,8 @@ with infamy.Test() as test: }}) with test.step("Verify interfaces 'veth0a' and 'veth0b' exist"): - assert iface.exist(target, veth0a), \ - f"Interface <{veth0a}> does not exist." - assert iface.exist(target, veth0b), \ - f"Interface <{veth0b}> does not exist." + until(lambda: iface.exist(target, veth0a)) + until(lambda: iface.exist(target, veth0b)) with test.step("Set IP address on target:data1 (dummy op)"): target.put_config_dicts({"ietf-interfaces": { @@ -94,10 +92,12 @@ with infamy.Test() as test: f"/ietf-interfaces:interfaces/interface[name='{veth0b}']", ]) - with test.step("Verify VETH pair has been removed"): - assert not iface.exist(target, veth0a), \ - f"Interface <{veth0a}> still exists!" - assert not iface.exist(target, veth0b), \ - f"Interface <{veth0b}> still exists!" + with test.step("Verify target:data1 and target:data2 still exist"): + until(lambda: iface.exist(target, data1)) + until(lambda: iface.exist(target, data2)) + + with test.step("Verify VETH pair have been removed"): + until(lambda: not iface.exist(target, veth0a)) + until(lambda: not iface.exist(target, veth0b)) test.succeed()