test: container_host_commands: Test more than one time

Have been seen Occasionally in tests that hostname not have been set,
try harder to check if it is set.
This commit is contained in:
Mattias Walström
2025-08-25 16:47:09 +02:00
parent a60968b7b2
commit edbc28a48b
@@ -75,11 +75,5 @@ nsenter -m/1/ns/mnt -u/1/ns/uts -i/1/ns/ipc -n/1/ns/net hostname {hostname_new}
until(lambda: c.running(cont_name), attempts=10)
with test.step("Verify the new hostname set by the container"):
oper = target.get_data("/ietf-system:system")
name = oper["system"]["hostname"]
if name != hostname_new:
print(f"Expected hostname: {hostname_new}, actual hostname: {name}")
test.fail()
until(lambda: c.running(cont_name) != target.get_data("/ietf-system:system")["system"]["hostname"], attempts=10)
test.succeed()