Skip to content

Commit abc7775

Browse files
ShadowCurseroypat
authored andcommitted
refactor(tests): simplify percent math
Don't ask how it got that bad. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 46dee82 commit abc7775

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

tests/integration_tests/performance/test_rate_limiter.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -428,13 +428,8 @@ def _run_iperf_on_host(iperf_cmd, test_microvm):
428428

429429
def _get_percentage_difference(measured, base):
430430
"""Return the percentage delta between the arguments."""
431-
if measured == base:
432-
return 0
433-
try:
434-
return (abs(measured - base) / base) * 100.0
435-
except ZeroDivisionError:
436-
# It means base and only base is 0.
437-
return 100.0
431+
assert base != 0
432+
return (abs(measured - base) / base) * 100.0
438433

439434

440435
def _process_iperf_line(line):

0 commit comments

Comments
 (0)