From 84386e6a1c46e96bacb6c449c7611904227f58fb Mon Sep 17 00:00:00 2001 From: Prince George <45705344+prgeor@users.noreply.github.com> Date: Thu, 16 Sep 2021 09:51:40 +0530 Subject: [PATCH] Fix occassional test_sfp_insert_events failure (#215) Due to rare timing issue test_sfp_insert_events failure can fail. Out of 100 iterations, the test failed on 82nd iteration. Signed-off-by: Prince George --- sonic-xcvrd/tests/test_xcvrd.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sonic-xcvrd/tests/test_xcvrd.py b/sonic-xcvrd/tests/test_xcvrd.py index a9255d82f23b..42146338ad9a 100644 --- a/sonic-xcvrd/tests/test_xcvrd.py +++ b/sonic-xcvrd/tests/test_xcvrd.py @@ -407,11 +407,12 @@ def test_sfp_insert_events(self): start = time.time() while True: _wrapper_soak_sfp_insert_event(sfp_insert_events, insert) - assert not bool(insert) if time.time() - start > MGMT_INIT_TIME_DELAY_SECS: break + assert not bool(insert) assert insert == port_dict + def test_sfp_remove_events(self): from xcvrd.xcvrd import _wrapper_soak_sfp_insert_event sfp_insert_events = {} @@ -423,4 +424,4 @@ def test_sfp_remove_events(self): time.sleep(1) _wrapper_soak_sfp_insert_event(sfp_insert_events, removal) - assert port_dict == removal \ No newline at end of file + assert port_dict == removal