Skip to content

Commit

Permalink
Increase code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
vvolam committed Nov 18, 2024
1 parent 16a28a3 commit 039e8fd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sonic-pcied/tests/test_DaemonPcied.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def test_run(self):
daemon_pcied.run()
assert daemon_pcied.check_pcie_devices.call_count == 1

@mock.patch('pcied.device_info.is_smartswitch', mock.MagicMock(return_value=True))
@mock.patch('pcied.load_platform_pcieutil', mock.MagicMock())
def test_is_dpu_in_detaching_mode(self):
daemon_pcied = pcied.DaemonPcied(SYSLOG_IDENTIFIER)
Expand Down Expand Up @@ -177,6 +178,7 @@ def test_is_dpu_in_detaching_mode(self):
daemon_pcied.detach_info.get.side_effect = Exception("Test exception")
assert daemon_pcied.is_dpu_in_detaching_mode('0000:03:00.1') == False

@mock.patch('pcied.device_info.is_smartswitch', mock.MagicMock(return_value=False))
@mock.patch('pcied.DaemonPcied.is_dpu_in_detaching_mode', mock.MagicMock(return_value=False))
@mock.patch('pcied.load_platform_pcieutil', mock.MagicMock())
def test_check_pcie_devices(self):
Expand All @@ -189,6 +191,7 @@ def test_check_pcie_devices(self):
assert daemon_pcied.update_pcie_devices_status_db.call_count == 1
assert daemon_pcied.check_n_update_pcie_aer_stats.call_count == 0

@mock.patch('pcied.device_info.is_smartswitch', mock.MagicMock(return_value=True))
@mock.patch('pcied.DaemonPcied.is_dpu_in_detaching_mode', mock.MagicMock(return_value=True))
@mock.patch('pcied.load_platform_pcieutil', mock.MagicMock())
def test_check_pcie_devices_detaching(self):
Expand Down

0 comments on commit 039e8fd

Please sign in to comment.