Skip to content

Commit

Permalink
Iproving coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
rameshraghupathy committed Dec 13, 2024
1 parent 0be0072 commit 93a1dff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/process-reboot-cause_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ def test_get_sorted_reboot_cause_files_error(self, mock_listdir):

# Test update_dpu_reboot_cause_to_chassis_state_db
@patch("builtins.open", new_callable=mock_open, read_data='{"cause": "Non-Hardware", "comment": "Switch rebooted DPU", "device": "DPU0", "time": "Fri Dec 13 01:12:36 AM UTC 2024", "name": "2024_12_13_01_12_36"}')
@patch("process_reboot_cause.device_info.get_dpu_list", return_value=["dpu1", "dpu2"])
@patch("process_reboot_cause.process_reboot_cause.get_sorted_reboot_cause_files")
@patch("process_reboot_cause.os.listdir", return_value=["2024_12_13_01_12_36_reboot_cause.txt", "2024_12_14_01_11_46_reboot_cause.txt"])
@patch("process_reboot_cause.swsscommon.SonicV2Connector")
def test_update_dpu_reboot_cause_to_chassis_state_db_update(self, mock_connector, mock_open):
def test_update_dpu_reboot_cause_to_chassis_state_db_update(self, mock_connector, mock_listdir, mock_get_sorted_files, mock_get_dpu_list, mock_open):
# Setup mocks
mock_get_sorted_files.return_value = ["/mock/dpu_history/2024_12_13_01_12_36_reboot_cause.txt"]

# Mock the database connection
mock_db = MagicMock()
mock_connector.return_value = mock_db
Expand Down

0 comments on commit 93a1dff

Please sign in to comment.