Skip to content

Commit

Permalink
Fix unit test error
Browse files Browse the repository at this point in the history
  • Loading branch information
chiourung committed Oct 23, 2024
1 parent f29a5db commit 6128836
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sonic-xcvrd/tests/test_xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -1879,6 +1879,7 @@ def test_CmisManagerTask_reset_port_active_apsel_to_db_error_cases(self, mock_fi
host_lanes_mask = 0xff

# Case: table does not exist
task.xcvr_table_helper = XcvrTableHelper(DEFAULT_NAMESPACE)
task.xcvr_table_helper.get_intf_tbl = MagicMock(return_value=None)
task.reset_port_active_apsel_to_db(lport, host_lanes_mask)
assert mock_field_value_pairs.call_count == 0
Expand Down Expand Up @@ -2404,10 +2405,13 @@ def test_CmisManagerTask_task_worker_fastboot(self, mock_chassis, mock_get_statu
task.get_configured_laser_freq_from_db = MagicMock(return_value=193100)
task.configure_tx_output_power = MagicMock(return_value=1)
task.configure_laser_frequency = MagicMock(return_value=1)
task.reset_port_active_apsel_to_db = MagicMock()

task.task_stopping_event.is_set = MagicMock(side_effect=[False, False, True])
task.task_worker()

assert mock_xcvr_api.tx_disable_channel.call_count == 1
assert task.reset_port_active_apsel_to_db.call_count == 1
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_READY

@patch('xcvrd.xcvrd.XcvrTableHelper.get_status_tbl')
Expand Down Expand Up @@ -2539,10 +2543,12 @@ def test_CmisManagerTask_task_worker_host_tx_ready_false(self, mock_chassis, moc
task.get_configured_laser_freq_from_db = MagicMock(return_value=193100)
task.configure_tx_output_power = MagicMock(return_value=1)
task.configure_laser_frequency = MagicMock(return_value=1)
task.reset_port_active_apsel_to_db = MagicMock()

task.task_stopping_event.is_set = MagicMock(side_effect=[False, False, True])
task.task_worker()

assert task.reset_port_active_apsel_to_db.call_count == 1
assert mock_xcvr_api.tx_disable_channel.call_count == 1
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_READY

Expand Down

0 comments on commit 6128836

Please sign in to comment.