Skip to content

Commit

Permalink
Use stratisd-tools stratis-checkmetadata
Browse files Browse the repository at this point in the history
Use this executable to verify properties of the Stratis pool-level
metadata.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Dec 11, 2024
1 parent e49167d commit 7945a4d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ def run_check(self, stop_time):
:param int stop_time: the time the test completed
"""
stratisd_tools = "stratisd-tools"

if PoolMetadataMonitor.verify: # pylint: disable=no-member

# Wait for D-Bus to settle, so D-Bus and metadata can be compared
Expand All @@ -281,6 +283,25 @@ def run_check(self, stop_time):
)

self._check_encryption_information_consistency(object_path, written)
with NamedTemporaryFile(mode="w") as temp_file:
temp_file.write(json.dumps(written))
temp_file.flush()

try:
with subprocess.Popen(
[
stratisd_tools,
"stratis-checkmetadata",
temp_file.name,
],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
) as proc:
(stdoutdata, _) = proc.communicate()
self.assertEqual(proc.returncode, 0, stdoutdata)
except FileNotFoundError as err:
raise RuntimeError(f"{stratisd_tools} not found") from err

else:
current_message = (
"" if current_return_code == _OK else current_message
Expand Down

0 comments on commit 7945a4d

Please sign in to comment.