From 4a5e3169d1519555519be6d7d7546c79237af10e Mon Sep 17 00:00:00 2001 From: junchao Date: Tue, 2 Nov 2021 09:43:28 +0800 Subject: [PATCH] Fix review comment Change-Id: I6e8491cf88330e141b5e0d8c809488c10a0be79f --- tests/copp/test_copp.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/copp/test_copp.py b/tests/copp/test_copp.py index da5c8f43e9e..47a42731d2b 100644 --- a/tests/copp/test_copp.py +++ b/tests/copp/test_copp.py @@ -112,7 +112,7 @@ def test_counter(self, protocol, duthosts, rand_one_dut_hostname, ptfhost, copp_ trap_type = protocol.lower() # wait until the trap counter is enabled - assert wait_until(10, 1, _check_trap_counter_enabled, duthost, trap_type), 'counter is not created for {}'.format(trap_type) + assert wait_until(10, 1, 0, _check_trap_counter_enabled, duthost, trap_type), 'counter is not created for {}'.format(trap_type) # clean previous counter value duthost.command('sonic-clear flowcnt-trap') @@ -132,7 +132,7 @@ def test_counter(self, protocol, duthosts, rand_one_dut_hostname, ptfhost, copp_ # wait for thread finish t.join() - + # get final packet count from CLI expect_rate = float(_SEND_PACKET_NUMBER / _SEND_DURATION) actual_packet_number = None @@ -141,7 +141,7 @@ def test_counter(self, protocol, duthosts, rand_one_dut_hostname, ptfhost, copp_ if 'trap name' in line and line['trap name'] == trap_type: actual_packet_number = int(line['packets'].replace(',', '')) break - + assert actual_packet_number == _SEND_PACKET_NUMBER, 'Trap {} expect send packet number: {}, but actual: {}'.format(trap_type, _SEND_PACKET_NUMBER, actual_packet_number) assert len(actual_rate) == 1, 'Failed to collect PPS value for trap {}'.format(trap_type) # Allow a 10 percent threshold for trap rate @@ -211,7 +211,7 @@ def ignore_expected_loganalyzer_exceptions(enum_rand_one_per_hwsku_frontend_host def counter_test(duthosts, rand_one_dut_hostname): duthost = duthosts[rand_one_dut_hostname] duthost.command('counterpoll flowcnt-trap enable') - + yield duthost.command('counterpoll flowcnt-trap disable') @@ -427,7 +427,7 @@ def _collect_counter_rate(duthost, trap_type, actual_rate): # PTF has not started yet logging.debug('Trap {} packets value is still 0, PTF has not started yet'.format(trap_type)) break - + logging.info('Trap {} current PPS value is {}, packets value is {}'.format(trap_type, pps_value, packets)) rate_values.append(float(pps_value[:-2])) break @@ -436,7 +436,7 @@ def _collect_counter_rate(duthost, trap_type, actual_rate): break time.sleep(0.5) max_wait -= 0.5 - + if rate_values: # Calculate max PPS max_pps = max(rate_values)