Skip to content

Commit

Permalink
Use an empty test metric file
Browse files Browse the repository at this point in the history
  • Loading branch information
Deezzir committed Sep 17, 2024
1 parent 5299662 commit fe54104
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ jobs:
python -m pip install 'tox<5'
- name: Run unit tests
run: sudo tox -e func
run: tox -e func
13 changes: 3 additions & 10 deletions tests/functional/test_snap_dcgm.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def check_config_exists(cls, config: str) -> str:
return str(dcgm_snap_config[config])

@classmethod
@retry(wait=wait_fixed(2), stop=stop_after_delay(10))
def check_metric_config(cls, metric_file: str) -> None:
dcgm_exporter_service = "snap.dcgm.dcgm-exporter"

Expand Down Expand Up @@ -125,14 +126,7 @@ def test_dcgm_metric_config(self) -> None:

self.check_config_exists(config)

with open(metric_file_path, "w") as f:
print(f"Wrote test metrics to {metric_file_path}")
f.writelines(
[
"# VGPU License status",
"DCGM_FI_DEV_VGPU_LICENSE_STATUS, gauge, vGPU License status",
]
)
subprocess.check_call(f"sudo touch {metric_file_path}".split())

self.set_config(service, config, metric_file)
self.check_metric_config(metric_file_path)
Expand All @@ -141,5 +135,4 @@ def test_dcgm_metric_config(self) -> None:
self.set_config(service, config)
self.check_metric_config("/etc/dcgm-exporter/default-counters.csv")

if os.path.exists(metric_file_path):
os.remove(metric_file_path)
subprocess.check_call(f"sudo rm {metric_file_path}".split())

0 comments on commit fe54104

Please sign in to comment.