Skip to content

Commit

Permalink
Add a test for plugin smartctl
Browse files Browse the repository at this point in the history
This test checks that the plugin returns a JSON string as expected.

Signed-off-by: Guillaume <[email protected]>
  • Loading branch information
gthvn1 committed Sep 12, 2023
1 parent 930885e commit 3bcd89e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/xapi-plugins/plugin_smartctl/test_smartctl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Requirements:
# From --hosts parameter:
# - host(A1): first XCP-ng host > 8.2.

import json

def _call_plugin(host, fn):
ret = host.call_plugin("smartctl.py", fn)
try:
json.loads(ret)
except ValueError:
assert False, "JSON string was expected but ValueError was raised"

def test_smartctl_information(host):
_call_plugin(host, "information")

def test_smartctl_health(host):
_call_plugin(host, "health")

0 comments on commit 3bcd89e

Please sign in to comment.