Skip to content

Commit

Permalink
Fix occassional test_sfp_insert_events failure (#215)
Browse files Browse the repository at this point in the history
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 <prgeor@microsoft.com>
  • Loading branch information
prgeor committed Sep 16, 2021
1 parent dfe737a commit 84386e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sonic-xcvrd/tests/test_xcvrd.py
Expand Up @@ -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 = {}
Expand All @@ -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
assert port_dict == removal

0 comments on commit 84386e6

Please sign in to comment.