diff --git a/scripts/monitor_dbus_signals.py b/scripts/monitor_dbus_signals.py index 289fad8..68fa992 100755 --- a/scripts/monitor_dbus_signals.py +++ b/scripts/monitor_dbus_signals.py @@ -429,6 +429,9 @@ def main(): except KeyboardInterrupt: + # isort: STDLIB + import copy + class Diff: # pylint: disable=too-few-public-methods """ Diff between two different managed object results. @@ -731,6 +734,23 @@ def _check(): print(os.linesep.join(_CALLBACK_ERRORS)) sys.exit(3) + # A sixteen second wait will make it virtually certain that + # stratisd has a chance to do one of its 10 second timer passes on + # pools and filesystems _and_ that the D-Bus task has at least one + # second to send out any resulting signals. + for _ in range(3): + current = copy.deepcopy(_MO) + time.sleep(15) + if current == _MO: + break + else: + # isort: THIRDPARTY + from deepdiff import DeepDiff + + diff = DeepDiff(current, _MO) + print(diff) + sys.exit(4) + try: result = _check() except Exception as exco: # pylint: disable=broad-except diff --git a/testlib/infra.py b/testlib/infra.py index 9617661..c963098 100644 --- a/testlib/infra.py +++ b/testlib/infra.py @@ -543,19 +543,12 @@ def setUp(self): except FileNotFoundError as err: raise RuntimeError("monitor_dbus_signals script not found.") from err - def run_check(self, stop_time): + def run_check(self): """ Stop the D-Bus monitor script and check the results. - - :param int stop_time: the time the test completed """ trace = getattr(self, "trace", None) if trace is not None: - # A sixteen second wait will make it virtually certain that - # stratisd has a chance to do one of its 10 second timer passes on - # pools and filesystems _and_ that the D-Bus task has at least one - # second to send out any resulting signals. - time.sleep(sleep_time(stop_time, 16)) self.trace.send_signal(signal.SIGINT) (stdoutdata, stderrdata) = self.trace.communicate() @@ -677,7 +670,7 @@ def teardown(self): Run post-test checks after test is completed. """ stop_time = time.monotonic_ns() - self.dbus_monitor.run_check(stop_time) + self.dbus_monitor.run_check() SysfsMonitor().run_check() SymlinkMonitor().run_check()