Skip to content

Commit f89465f

Browse files
committed
refactor(tests): don't reuse iperf on the host
Similar to the RX tests, in TX tests we can just use one shot servers on the host. This should prevent any instability with host iperf caused by reuse. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
1 parent 96074e5 commit f89465f

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

tests/integration_tests/performance/test_rate_limiter.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,6 @@ def _check_tx_rate_limiting(test_microvm):
139139
eth1 = test_microvm.iface["eth1"]["iface"]
140140
eth2 = test_microvm.iface["eth2"]["iface"]
141141

142-
# Start iperf server on the host as this is the tx rate limiting test.
143-
_start_iperf_server_on_host(test_microvm.netns.cmd_prefix())
144-
145142
# First step: get the transfer rate when no rate limiting is enabled.
146143
# We are receiving the result in KBytes from iperf.
147144
print("Run guest TX iperf for no rate limiting")
@@ -286,6 +283,8 @@ def _check_rx_rate_limit_patch(test_microvm):
286283
def _get_tx_bandwidth(test_microvm, host_ip):
287284
"""Check that the rate-limited TX bandwidth is close to what we expect."""
288285

286+
_start_iperf_server_on_host(test_microvm.netns.cmd_prefix())
287+
289288
iperf_cmd = "{} -c {} -t {} -f KBytes -w {} -N".format(
290289
IPERF_BINARY, host_ip, IPERF_TRANSMIT_TIME, IPERF_TCP_WINDOW
291290
)
@@ -350,14 +349,10 @@ def _run_iperf_on_guest(test_microvm, iperf_cmd):
350349

351350
def _start_iperf_server_on_host(netns_cmd_prefix):
352351
"""Start iperf in server mode after killing any leftover iperf daemon."""
353-
iperf_cmd = "pkill {}\n".format(IPERF_BINARY)
354-
355-
# Don't check the result of this command because it can fail if no iperf
356-
# is running.
357-
utils.run_cmd(iperf_cmd)
352+
kill_cmd = f"pkill {IPERF_BINARY}"
353+
utils.run_cmd(kill_cmd)
358354

359355
iperf_cmd = "{} {} -sD -f KBytes\n".format(netns_cmd_prefix, IPERF_BINARY)
360-
361356
utils.check_output(iperf_cmd)
362357

363358
# Wait for the iperf daemon to start.

0 commit comments

Comments
 (0)