From c86ba223c8a87dad33772701d4b5325935c4d7ae Mon Sep 17 00:00:00 2001 From: mulhern Date: Fri, 21 Jun 2024 08:53:58 -0400 Subject: [PATCH] Require stratis-decode-dm only if running check Signed-off-by: mulhern --- testlib/infra.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/testlib/infra.py b/testlib/infra.py index 3434468..d7e3260 100644 --- a/testlib/infra.py +++ b/testlib/infra.py @@ -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 @@ -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() @@ -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", ] @@ -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):