Skip to content

Commit

Permalink
Update test_xcvrd.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AnoopKamath committed May 17, 2024
1 parent 2fb6f92 commit 674945f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,9 +1538,6 @@ def get_application(lane):
mock_xcvr_api.decommission_all_datapaths = MagicMock(return_value=True)
assert task.is_appl_reconfigure_required(mock_xcvr_api, app_new) == True

mock_xcvr_api.decommission_all_datapaths = MagicMock(return_value=False)
assert task.is_appl_reconfigure_required(mock_xcvr_api, app_new) == False

DEFAULT_DP_STATE = {
'DP1State': 'DataPathActivated',
'DP2State': 'DataPathActivated',
Expand Down Expand Up @@ -1882,6 +1879,13 @@ def test_CmisManagerTask_task_worker(self, mock_chassis, mock_get_status_tbl):
task.configure_tx_output_power = MagicMock(return_value=1)
task.configure_laser_frequency = MagicMock(return_value=1)

task.is_appl_reconfigure_required = MagicMock(return_value=False)
# Fail test coverage - Module Inserted state failing to reach DP_DEINIT
task.task_stopping_event.is_set = MagicMock(side_effect=[False, False, True])
task.task_worker()
assert get_cmis_state_from_state_db('Ethernet0', task.xcvr_table_helper.get_status_tbl(task.port_mapping.get_asic_id_for_logical_port('Ethernet0'))) == CMIS_STATE_INSERTED

task.is_appl_reconfigure_required = MagicMock(return_value=True)
# Case 1: Module Inserted --> DP_DEINIT
task.task_stopping_event.is_set = MagicMock(side_effect=[False, False, True])
task.task_worker()
Expand Down

0 comments on commit 674945f

Please sign in to comment.