Skip to content

Commit

Permalink
Require stratis-decode-dm only if running check
Browse files Browse the repository at this point in the history
Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Jun 21, 2024
1 parent 34b89c7 commit c86ba22
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,6 @@ class FilesystemSymlinkMonitor(unittest.TestCase):
Verify that devicmapper devices for filesystems have corresponding symlinks.
"""

_DECODE_DM = "stratis-decode-dm"

def run_check(self, stop_time):
"""
Check that the filesystem links on the D-Bus and the filesystem links
Expand All @@ -351,6 +349,8 @@ def run_check(self, stop_time):
if not FilesystemSymlinkMonitor.verify_devices: # pylint: disable=no-member
pass

decode_dm = "stratis-decode-dm"

time.sleep(sleep_time(stop_time, 16))

managed_objects = StratisDbus.get_managed_objects()
Expand All @@ -368,7 +368,7 @@ def run_check(self, stop_time):
for dev in fnmatch.filter(os.listdir(DEV_MAPPER), "stratis-1-*-thin-fs-*"):
found += 1
command = [
FilesystemSymlinkMonitor._DECODE_DM,
decode_dm,
os.path.join(DEV_MAPPER, dev),
"--output=symlink",
]
Expand All @@ -385,13 +385,12 @@ def run_check(self, stop_time):
self.assertIn(symlink, filesystems)
else:
raise RuntimeError(
f"{FilesystemSymlinkMonitor._DECODE_DM} "
f"invocation failed: {stderrdata.decode('utf-8')}"
f"{decode_dm} invocation failed: "
f"{stderrdata.decode('utf-8')}"
)
except FileNotFoundError as err:
raise RuntimeError(
f"Script '{FilesystemSymlinkMonitor._DECODE_DM}' "
"missing, test could not be run"
f"Script '{decode_dm}' missing, test could not be run"
) from err

if found != len(filesystems):
Expand Down

0 comments on commit c86ba22

Please sign in to comment.