Skip to content

Commit 32f81d0

Browse files
ShadowCurseroypat
authored andcommitted
refactor(tests): remove retry attempt for bandwidth check
There is no reason to do a single retry with specific time multiplier. If retry is indeed is needed it can be implemented with a simple loop inside or outside the function. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent abc7775 commit 32f81d0

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

tests/integration_tests/performance/test_rate_limiter.py

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -287,29 +287,12 @@ def _check_rx_rate_limit_patch(test_microvm):
287287

288288

289289
def _check_tx_bandwidth(test_microvm, ip, expected_kbps):
290-
"""Check that the rate-limited TX bandwidth is close to what we expect.
291-
292-
At this point, a daemonized iperf3 server is expected to be running on
293-
the host.
294-
"""
295-
print("Check guest TX rate-limit; expected kbps {}".format(expected_kbps))
290+
"""Check that the rate-limited TX bandwidth is close to what we expect."""
296291
observed_kbps = _get_tx_bandwidth_with_duration(
297292
test_microvm, ip, IPERF_TRANSMIT_TIME
298293
)
299-
300294
diff_pc = _get_percentage_difference(observed_kbps, expected_kbps)
301-
print("TX calculated diff percentage: {}\n".format(diff_pc))
302-
303-
if diff_pc >= MAX_BYTES_DIFF_PERCENTAGE:
304-
print("Short duration test failed. Try another run with 10x duration.")
305-
306-
observed_kbps = _get_tx_bandwidth_with_duration(
307-
test_microvm, ip, 10 * IPERF_TRANSMIT_TIME
308-
)
309-
diff_pc = _get_percentage_difference(observed_kbps, expected_kbps)
310-
print("TX calculated diff percentage: {}\n".format(diff_pc))
311-
312-
assert diff_pc < MAX_BYTES_DIFF_PERCENTAGE
295+
assert diff_pc < MAX_BYTES_DIFF_PERCENTAGE
313296

314297

315298
def _get_tx_bandwidth_with_duration(test_microvm, host_ip, duration):
@@ -327,29 +310,12 @@ def _get_tx_bandwidth_with_duration(test_microvm, host_ip, duration):
327310

328311

329312
def _check_rx_bandwidth(test_microvm, ip, expected_kbps):
330-
"""Check that the rate-limited RX bandwidth is close to what we expect.
331-
332-
At this point, a daemonized iperf3 server is expected to be running on
333-
the guest.
334-
"""
335-
print("Check guest RX rate-limit; expected kbps {}".format(expected_kbps))
313+
"""Check that the rate-limited RX bandwidth is close to what we expect."""
336314
observed_kbps = _get_rx_bandwidth_with_duration(
337315
test_microvm, ip, IPERF_TRANSMIT_TIME
338316
)
339-
340317
diff_pc = _get_percentage_difference(observed_kbps, expected_kbps)
341-
print("RX calculated diff percentage: {}\n".format(diff_pc))
342-
343-
if diff_pc >= MAX_BYTES_DIFF_PERCENTAGE:
344-
print("Short duration test failed. Try another run with 10x duration.")
345-
346-
observed_kbps = _get_rx_bandwidth_with_duration(
347-
test_microvm, ip, 10 * IPERF_TRANSMIT_TIME
348-
)
349-
diff_pc = _get_percentage_difference(observed_kbps, expected_kbps)
350-
print("TX calculated diff percentage: {}\n".format(diff_pc))
351-
352-
assert diff_pc < MAX_BYTES_DIFF_PERCENTAGE
318+
assert diff_pc < MAX_BYTES_DIFF_PERCENTAGE
353319

354320

355321
def _get_rx_bandwidth_with_duration(test_microvm, guest_ip, duration):

0 commit comments

Comments
 (0)