Skip to content

Commit edf6d1c

Browse files
ShadowCurseroypat
authored andcommitted
refactor(tests): don't reuse iperf in the guset
Don't reuse iperf in the guest for RX tests since it was causing intermittent issues. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 32f81d0 commit edf6d1c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tests/integration_tests/performance/test_rate_limiter.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ def _check_rx_rate_limiting(test_microvm):
188188
eth1 = test_microvm.iface["eth1"]["iface"]
189189
eth2 = test_microvm.iface["eth2"]["iface"]
190190

191-
# Start iperf server on guest.
192-
_start_iperf_server_on_guest(test_microvm)
193-
194191
# First step: get the transfer rate when no rate limiting is enabled.
195192
# We are receiving the result in KBytes from iperf.
196193
print("Run guest RX iperf with no rate limiting")
@@ -297,10 +294,10 @@ def _check_tx_bandwidth(test_microvm, ip, expected_kbps):
297294

298295
def _get_tx_bandwidth_with_duration(test_microvm, host_ip, duration):
299296
"""Check that the rate-limited TX bandwidth is close to what we expect."""
297+
300298
iperf_cmd = "{} -c {} -t {} -f KBytes -w {} -N".format(
301299
IPERF_BINARY, host_ip, duration, IPERF_TCP_WINDOW
302300
)
303-
304301
iperf_out = _run_iperf_on_guest(test_microvm, iperf_cmd)
305302
print(iperf_out)
306303

@@ -320,6 +317,9 @@ def _check_rx_bandwidth(test_microvm, ip, expected_kbps):
320317

321318
def _get_rx_bandwidth_with_duration(test_microvm, guest_ip, duration):
322319
"""Check that the rate-limited RX bandwidth is close to what we expect."""
320+
321+
_start_iperf_server_on_guest(test_microvm)
322+
323323
iperf_cmd = "{} {} -c {} -t {} -f KBytes -w {} -N".format(
324324
test_microvm.netns.cmd_prefix(),
325325
IPERF_BINARY,
@@ -351,10 +351,13 @@ def _patch_iface_bw(test_microvm, iface_id, rx_or_tx, new_bucket_size, new_refil
351351

352352
def _start_iperf_server_on_guest(test_microvm):
353353
"""Start iperf in server mode through an SSH connection."""
354+
kill_cmd = f"pkill {IPERF_BINARY}"
355+
test_microvm.ssh.run(kill_cmd)
356+
354357
iperf_cmd = f"{IPERF_BINARY} -sD -f KBytes --logfile {GUEST_IPERF_SERVER_LOG}"
355358
test_microvm.ssh.run(iperf_cmd)
356359

357-
# Wait for the iperf daemon to start.
360+
# Wait for the iperf to start.
358361
time.sleep(1)
359362

360363

0 commit comments

Comments
 (0)