Skip to content

Commit df6d583

Browse files
committed
format as double instead of int
1 parent 2cdffb6 commit df6d583

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

lisa/microsoft/testsuites/dpdk/dpdktestpmd.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,8 @@ def check_tx_packet_drops(self) -> None:
766766
raise AssertionError(
767767
"Test bug: tx packet data was 0, could not check dropped packets"
768768
)
769-
self.dropped_packet_percentage = self.tx_packet_drops / self.tx_total_packets
770-
assert_that(self.dropped_packet_percentage).described_as(
769+
self.packet_drop_rate = self.tx_packet_drops / self.tx_total_packets
770+
assert_that(self.packet_drop_rate).described_as(
771771
"More than 33% of the tx packets were dropped!"
772772
).is_close_to(0, 0.33)
773773

@@ -776,8 +776,8 @@ def check_rx_packet_drops(self) -> None:
776776
raise AssertionError(
777777
"Test bug: rx packet data was 0 could not check dropped packets."
778778
)
779-
self.dropped_packet_percentage = self.rx_packet_drops / self.rx_total_packets
780-
assert_that(self.dropped_packet_percentage).described_as(
779+
self.packet_drop_rate = self.rx_packet_drops / self.rx_total_packets
780+
assert_that(self.packet_drop_rate).described_as(
781781
"More than 1% of the received packets were dropped!"
782782
).is_close_to(0, 0.01)
783783

lisa/microsoft/testsuites/dpdk/dpdkutil.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -688,10 +688,11 @@ def annotate_packet_drops(
688688
log: Logger, result: Optional[TestResult], receiver: DpdkTestResources
689689
) -> None:
690690
try:
691-
if result and hasattr(receiver.testpmd, "dropped_packet_percentage"):
692-
dropped_packets = receiver.testpmd.dropped_packet_percentage
693-
result.information["rx_pkt_drop_percent"] = int(100 * dropped_packets)
694-
log.debug(f"Adding packet drop percentage: {dropped_packets}")
691+
if result and hasattr(receiver.testpmd, "packet_drop_rate"):
692+
dropped_packets = receiver.testpmd.packet_drop_rate
693+
result.information["rx_pkt_drop_rate"] = f"{dropped_packets:.2f}"
694+
log.debug("Adding packet drop percentage: "
695+
f"{result.information["rx_pkt_drop_rate"]}")
695696
except AssertionError as err:
696697
receiver.node.log.debug(f"Could not add rx packet drop percentage: {str(err)}")
697698

0 commit comments

Comments
 (0)