Skip to content

Commit da2cf90

Browse files
committed
Wait to stop receiving D-Bus signals in monitor script
We want to verify that stratisd is not sending more signals before we verify that the results are correct in the script itself. Don't delay when running the test, since the script will do the delay itself. Signed-off-by: mulhern <amulhern@redhat.com>
1 parent 7edb7e2 commit da2cf90

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

scripts/monitor_dbus_signals.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,9 @@ def main():
429429

430430
except KeyboardInterrupt:
431431

432+
# isort: STDLIB
433+
import copy
434+
432435
class Diff: # pylint: disable=too-few-public-methods
433436
"""
434437
Diff between two different managed object results.
@@ -731,6 +734,14 @@ def _check():
731734
print(os.linesep.join(_CALLBACK_ERRORS))
732735
sys.exit(3)
733736

737+
for _ in range(3):
738+
current = copy.deepcopy(_MO)
739+
time.sleep(15)
740+
if current == _MO:
741+
break
742+
else:
743+
sys.exit(4)
744+
734745
try:
735746
result = _check()
736747
except Exception as exco: # pylint: disable=broad-except

testlib/infra.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -543,19 +543,16 @@ def setUp(self):
543543
except FileNotFoundError as err:
544544
raise RuntimeError("monitor_dbus_signals script not found.") from err
545545

546-
def run_check(self, stop_time):
546+
def run_check(self):
547547
"""
548548
Stop the D-Bus monitor script and check the results.
549-
550-
:param int stop_time: the time the test completed
551549
"""
552550
trace = getattr(self, "trace", None)
553551
if trace is not None:
554552
# A sixteen second wait will make it virtually certain that
555553
# stratisd has a chance to do one of its 10 second timer passes on
556554
# pools and filesystems _and_ that the D-Bus task has at least one
557555
# second to send out any resulting signals.
558-
time.sleep(sleep_time(stop_time, 16))
559556
self.trace.send_signal(signal.SIGINT)
560557
(stdoutdata, stderrdata) = self.trace.communicate()
561558

@@ -677,7 +674,7 @@ def teardown(self):
677674
Run post-test checks after test is completed.
678675
"""
679676
stop_time = time.monotonic_ns()
680-
self.dbus_monitor.run_check(stop_time)
677+
self.dbus_monitor.run_check()
681678

682679
SysfsMonitor().run_check()
683680
SymlinkMonitor().run_check()

0 commit comments

Comments
 (0)