Skip to content

Commit 0e072b5

Browse files
committed
Use stratisd-tools stratis-checkmetadata
Use this executable to verify properties of the Stratis pool-level metadata. Signed-off-by: mulhern <amulhern@redhat.com>
1 parent e49167d commit 0e072b5

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

testlib/infra.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ def run_check(self, stop_time):
258258
259259
:param int stop_time: the time the test completed
260260
"""
261+
stratisd_tools = "stratisd-tools"
262+
261263
if PoolMetadataMonitor.verify: # pylint: disable=no-member
262264

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

283285
self._check_encryption_information_consistency(object_path, written)
286+
287+
with NamedTemporaryFile(mode="w") as temp_file:
288+
temp_file.write(json.dumps(written))
289+
temp_file.flush()
290+
291+
try:
292+
with subprocess.Popen(
293+
[
294+
stratisd_tools,
295+
"stratis-checkmetadata",
296+
temp_file.name,
297+
],
298+
stdout=subprocess.PIPE,
299+
) as proc:
300+
(stdoutdata, _) = proc.communicate()
301+
self.assertEqual(proc.returncode, 0, stdoutdata)
302+
except FileNotFoundError as err:
303+
raise RuntimeError(f"{stratisd_tools} not found") from err
304+
284305
else:
285306
current_message = (
286307
"" if current_return_code == _OK else current_message

0 commit comments

Comments
 (0)