Skip to content

Commit baeeaf9

Browse files
authored
feat: fix #16080 (#16705)
Description of PR Summary: Use method round() to suit better need comparing to ceil vs int(). Fixes # (issue) #16080 Signed-off-by: Austin Pham <[email protected]>
1 parent b559db9 commit baeeaf9

6 files changed

+6
-7
lines changed

tests/snappi_tests/multidut/pfc/files/lossless_response_to_external_pause_storms_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def run_lossless_response_to_external_pause_storms_test(api,
154154
total_rx_pkts = rx_pkts_1 + rx_pkts_2
155155
# Calculate the drop percentage
156156
drop_percentage = 100 * pkt_drop / total_rx_pkts
157-
pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')
157+
pytest_assert(round(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')
158158

159159
verify_external_pause_storm_result(flow_stats,
160160
tx_port,

tests/snappi_tests/multidut/pfc/files/lossless_response_to_throttling_pause_storms_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def run_lossless_response_to_throttling_pause_storms_test(api,
161161
total_rx_pkts = rx_pkts_1 + rx_pkts_2
162162
# Calculate the drop percentage
163163
drop_percentage = 100 * pkt_drop / total_rx_pkts
164-
pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')
164+
pytest_assert(round(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')
165165

166166
""" Verify Results """
167167
verify_throttling_pause_storm_result(flow_stats,

tests/snappi_tests/multidut/pfc/files/m2o_fluctuating_lossless_helper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging # noqa: F401
2-
from math import ceil
32
from tests.common.helpers.assertions import pytest_assert, pytest_require # noqa: F401
43
from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401
54
from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401
@@ -143,7 +142,7 @@ def run_m2o_fluctuating_lossless_test(api,
143142
total_rx_pkts = rx_pkts_1 + rx_pkts_2
144143
# Calculate the drop percentage
145144
drop_percentage = 100 * pkt_drop / total_rx_pkts
146-
pytest_assert(ceil(drop_percentage) == 8, 'FAIL: Drop packets must be around 8 percent')
145+
pytest_assert(round(drop_percentage) == 8, 'FAIL: Drop packets must be around 8 percent')
147146

148147
""" Verify Results """
149148
verify_m2o_fluctuating_lossless_result(flow_stats,

tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def run_m2o_oversubscribe_lossless_test(api,
146146
total_rx_pkts = rx_pkts_1 + rx_pkts_2
147147
# Calculate the drop percentage
148148
drop_percentage = 100 * pkt_drop / total_rx_pkts
149-
pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')
149+
pytest_assert(round(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters')
150150

151151
""" Verify Results """
152152
verify_m2o_oversubscribe_lossless_result(flow_stats,

tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_lossy_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def run_pfc_m2o_oversubscribe_lossless_lossy_test(api,
151151
total_rx_pkts = rx_pkts_1 + rx_pkts_2
152152
# Calculate the drop percentage
153153
drop_percentage = 100 * pkt_drop / total_rx_pkts
154-
pytest_assert(ceil(drop_percentage) == 5, 'FAIL: Drop packets must be around 5 percent')
154+
pytest_assert(round(drop_percentage) == 5, 'FAIL: Drop packets must be around 5 percent')
155155

156156
""" Verify Results """
157157
verify_m2o_oversubscribe_lossless_lossy_result(flow_stats,

tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossy_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def run_pfc_m2o_oversubscribe_lossy_test(api,
151151
total_rx_pkts = rx_pkts_1 + rx_pkts_2
152152
# Calculate the drop percentage
153153
drop_percentage = 100 * pkt_drop / total_rx_pkts
154-
pytest_assert(ceil(drop_percentage) == 10, 'FAIL: Drop packets must be around 10 percent')
154+
pytest_assert(round(drop_percentage) == 10, 'FAIL: Drop packets must be around 10 percent')
155155

156156
""" Verify Results """
157157
verify_m2o_oversubscribe_lossy_result(flow_stats,

0 commit comments

Comments
 (0)