Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions scripts/monitor_dbus_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
11 changes: 2 additions & 9 deletions testlib/infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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()
Expand Down