Skip to content

Commit 36c8d95

Browse files
Manciukicroypat
authored andcommitted
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 <mancio@amazon.com>
1 parent 805675a commit 36c8d95

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

tests/integration_tests/functional/test_net.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import time
77

88
import pytest
9+
from tenacity import Retrying, stop_after_attempt, wait_fixed
910

1011
from framework import utils
1112

@@ -118,5 +119,12 @@ def test_tap_offload(uvm_any):
118119
vm.netns.check_output(f"python3 ./host_tools/udp_offload.py {vm.ssh.host} {port}")
119120

120121
# Check that the server received the message
121-
ret = vm.ssh.run(f"sync ; cat {out_filename}")
122-
assert ret.stdout == message, f"{ret.stdout=} {ret.stderr=}"
122+
# Allow for some delay due to the asynchronous nature of the test
123+
for attempt in Retrying(
124+
stop=stop_after_attempt(10),
125+
wait=wait_fixed(0.1),
126+
reraise=True,
127+
):
128+
with attempt:
129+
ret = vm.ssh.check_output(f"sync; cat {out_filename}")
130+
assert ret.stdout == message, f"{ret.stdout=} {ret.stderr=}"

0 commit comments

Comments
 (0)