Skip to content

Commit

Permalink
Add test to check if smartctl-exporter snap is being installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Deezzir committed Nov 15, 2024
1 parent c4f807b commit fd3366a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/functional/test_charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,19 @@ async def test_redfish_client_timeout_config(self, app, unit, ops_test, provided
assert config["redfish_client_timeout"] == int(new_timeout)

await app.reset_config(["collect-timeout"])

async def test_smarctl_exporter_snap_available(self, ops_test, app, unit):
"""Test if smartctl exporter snap is installed and ranning on the unit."""
snap_name = "smartctl-exporter"
cmd = f"snap list {snap_name}"
results = await run_command_on_unit(ops_test, unit.name, cmd)
assert results.get("return-code") == 0
assert snap_name in results.get("stdout").strip()

check_active_cmd = "systemctl is-active snap.smartctl-exporter.smartctl-exporter"
results = await run_command_on_unit(ops_test, unit.name, check_active_cmd)
assert results.get("return-code") == 0
assert results.get("stdout").strip() == "active"

async def test_metrics_available(self, app, unit, ops_test):
"""Test if metrics are available at the expected endpoint on unit."""
Expand Down

0 comments on commit fd3366a

Please sign in to comment.