Skip to content

Commit

Permalink
Refine
Browse files Browse the repository at this point in the history
  • Loading branch information
Deezzir committed Sep 13, 2024
1 parent c2ea073 commit 439376e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
21 changes: 9 additions & 12 deletions tests/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import subprocess

import pytest
import yaml


@pytest.fixture(scope="session", autouse=True)
def install_dcgm_snap():
"""Install the snap and enable dcgm-exporter service for testing."""
with open("snap/snapcraft.yaml") as f:
snapcraft = yaml.safe_load(f)
snap_build_name = f"{snapcraft['name']}_*.snap"
snap_build_name = "dcgm_*.snap"

subprocess.run(
f"sudo snap install --devmode {snap_build_name}",
check=True,
capture_output=True,
shell=True,
)
subprocess.run(
f"sudo snap install --dangerous {snap_build_name}",
check=True,
capture_output=True,
shell=True,
)

yield
yield

subprocess.run("sudo snap remove --purge dcgm".split(), check=True)
subprocess.run("sudo snap remove --purge dcgm".split(), check=True)
1 change: 1 addition & 0 deletions tests/functional/test_snap_dcgm.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_dcgm_exporter():
)
assert " active" in result.stdout.strip(), "dcgm-exporter service is not active"

# Check the exporter endpoint, will raise an exception if the endpoint is not reachable
urllib.request.urlopen(endpoint)


Expand Down

0 comments on commit 439376e

Please sign in to comment.