Skip to content

Commit

Permalink
Fix unit test typos
Browse files Browse the repository at this point in the history
  • Loading branch information
Deezzir committed Sep 27, 2024
1 parent c7c62f0 commit 1ba77bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ def install(self) -> bool:
if not super().install():
return False

logger.info("Creating a custom metrics file and configuring the DCGM snap to use it")
try:
logger.info("Creating a custom metrics file and configuring the DCGM snap to use it")
shutil.copy(self.metrics_file, self.snap_common)
self.snap_client.set({self.metric_config: self.metric_config_value})
self.snap_client.restart(reload=True)
Expand Down
16 changes: 8 additions & 8 deletions tests/unit/test_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,23 +844,23 @@ def test_install_failed(self):

exporter_install_ok = self.exporter.install()

self.exporter.strategy.install.accept_called()
self.mock_shutil.copy.accept_not_called()
self.exporter.strategy.install.assert_called()
self.mock_shutil.copy.assert_not_called()
self.assertFalse(exporter_install_ok)

def test_install_success(self):
self.exporter.snap_client.present = True

exporter_install_ok = self.exporter.install()

self.exporter.strategy.install.accept_called()
self.mock_shutil.copy.accept_called_with(
self.exporter.strategy.install.assert_called()
self.mock_shutil.copy.assert_called_with(
self.exporter.metrics_file, self.exporter.snap_common
)
self.exporter.snap_client.set.accept_called_with(
self.exporter.snap_client.set.assert_called_with(
{self.exporter.metric_config: self.exporter.metric_config_value}
)
self.exporter.snap_client.restart.accept_called_with(reload=True)
self.exporter.snap_client.restart.assert_called_with(reload=True)
self.assertTrue(exporter_install_ok)

def test_install_metrics_copy_fail(self):
Expand All @@ -869,8 +869,8 @@ def test_install_metrics_copy_fail(self):

exporter_install_ok = self.exporter.install()

self.exporter.strategy.install.accept_called()
self.exporter.snap_client.restart.accept_not_called()
self.exporter.strategy.install.assert_called()
self.exporter.snap_client.restart.assert_not_called()
self.assertFalse(exporter_install_ok)


Expand Down

0 comments on commit 1ba77bf

Please sign in to comment.