Skip to content

Commit d606df5

Browse files
zulinx86wearyzen
authored andcommitted
test: Fail early when iperf3 exits with non-0 code
stderr can be empty when iperf3 exits with non-0 code: ``` $ iperf3 -c 127.0.0.1 iperf3: error - unable to connect to server: Connection refused $ iperf3 -c 127.0.0.1 >/dev/null $ echo $? 1 ``` To make it easier to debug iperf3-related issues, asserts the exit code of iperf3 command is 0. Signed-off-by: Takahiro Itazuri <[email protected]>
1 parent 43fb717 commit d606df5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/integration_tests/functional/test_rate_limiter.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,8 @@ def _start_iperf_on_guest(test_microvm, hostname):
434434
def _run_iperf_on_guest(test_microvm, iperf_cmd, hostname):
435435
"""Run a client related iperf command through an SSH connection."""
436436
test_microvm.ssh_config["hostname"] = hostname
437-
_, stdout, stderr = test_microvm.ssh.execute_command(iperf_cmd)
438-
assert stderr.read() == ""
437+
code, stdout, stderr = test_microvm.ssh.execute_command(iperf_cmd)
438+
assert code == 0, f"stdout: {stdout.read()}\nstderr: {stderr.read()}"
439439

440440
out = stdout.read()
441441
return out
@@ -459,8 +459,10 @@ def _start_local_iperf(netns_cmd_prefix):
459459

460460
def _run_local_iperf(iperf_cmd):
461461
"""Execute a client related iperf command locally."""
462-
process = utils.run_cmd(iperf_cmd)
463-
return process.stdout
462+
code, stdout, stderr = utils.run_cmd(iperf_cmd)
463+
assert code == 0, f"stdout: {stdout}\nstderr: {stderr}"
464+
465+
return stdout
464466

465467

466468
def _get_percentage_difference(measured, base):

0 commit comments

Comments
 (0)