Skip to content

Commit 76f6eeb

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 aa34e99 commit 76f6eeb

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")
@@ -288,6 +285,8 @@ def _check_rx_rate_limit_patch(test_microvm):
288285
def _get_tx_bandwidth(test_microvm, host_ip):
289286
"""Check that the rate-limited TX bandwidth is close to what we expect."""
290287

288+
_start_iperf_server_on_host(test_microvm.netns.cmd_prefix())
289+
291290
iperf_cmd = "{} -c {} -t {} -f KBytes -w {} -N".format(
292291
IPERF_BINARY, host_ip, IPERF_TRANSMIT_TIME, IPERF_TCP_WINDOW
293292
)
@@ -352,14 +351,10 @@ def _run_iperf_on_guest(test_microvm, iperf_cmd):
352351

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

361-
iperf_cmd = "{} {} -sD -f KBytes\n".format(netns_cmd_prefix, IPERF_BINARY)
362-
357+
iperf_cmd = "{} {} -s -1 -f KBytes\n".format(netns_cmd_prefix, IPERF_BINARY)
363358
utils.check_output(iperf_cmd)
364359

365360
# Wait for the iperf daemon to start.

0 commit comments

Comments
 (0)