Skip to content

Commit 1d7cc3a

Browse files
committed
test(net): add retry in test_tap_offload
This test has been flaky for a while, where sometimes the file is empty. As we're just interested that the message got delivered, not that the file was created in a timely manner, I'm adding a small retry. Signed-off-by: Riccardo Mancini <[email protected]>
1 parent 9646291 commit 1d7cc3a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/integration_tests/functional/test_net.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,5 +118,13 @@ def test_tap_offload(uvm_any):
118118
vm.netns.check_output(f"python3 ./host_tools/udp_offload.py {vm.ssh.host} {port}")
119119

120120
# Check that the server received the message
121-
ret = vm.ssh.run(f"sync ; cat {out_filename}")
121+
# Allow for some delay due to the asynchronous nature of the test
122+
retry = 10
123+
while retry > 0:
124+
ret = vm.ssh.run(f"sync ; cat {out_filename}")
125+
if ret.stdout.strip():
126+
break
127+
time.sleep(0.1)
128+
retry -= 1
129+
122130
assert ret.stdout == message, f"{ret.stdout=} {ret.stderr=}"

0 commit comments

Comments
 (0)