Skip to content

Commit

Permalink
tests(nvml/check): add unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Massimiliano Giovagnoli <[email protected]>
  • Loading branch information
maxgio92 committed Nov 22, 2024
1 parent 2e5f183 commit 2d46e2c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nvml/tests/test_nvml.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,19 @@ def test_check(aggregator, instance):
aggregator.assert_metric('nvml.compute_running_process', tags=expected_tags + ["pid:1"], count=1)

aggregator.assert_all_metrics_covered()


@pytest.mark.unit
def test_is_nvml_library_available(instance):
check = NvmlCheck('nvml', {}, [instance])
res = check.is_nvml_library_available()
assert res is False


@pytest.mark.unit
def test_discover_instances(instance):
check = NvmlCheck('nvml', {}, [instance])
try:
check.discover_instances('1s')
except Exception as e:
pytest.Fail(f"Unexpected exception raised: {e}")

0 comments on commit 2d46e2c

Please sign in to comment.