From f1661d35eabdb9700acb28eb46dbeb98983a216c Mon Sep 17 00:00:00 2001 From: sebres Date: Thu, 1 Feb 2018 18:30:00 +0100 Subject: [PATCH] fix sporadic error, wait for shutdown/exit messages by assert-check, better prevention of dual (parallel) stop --- fail2ban/tests/fail2banclienttestcase.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fail2ban/tests/fail2banclienttestcase.py b/fail2ban/tests/fail2banclienttestcase.py index 92e08bfc1..318a1c509 100644 --- a/fail2ban/tests/fail2banclienttestcase.py +++ b/fail2ban/tests/fail2banclienttestcase.py @@ -312,7 +312,9 @@ def with_foreground_server_thread(startextra={}): # wait for end sign: Utils.wait_for(lambda: phase.get('end', None) is not None, MAX_WAITTIME) self.assertTrue(phase.get('end', None)) - self.assertLogged("Shutdown successful", "Exiting Fail2ban", all=True) + self.assertLogged("Shutdown successful", "Exiting Fail2ban", all=True, wait=MAX_WAITTIME) + # set to NOP: avoid dual call + self.stopAndWaitForServerEnd = lambda *args, **kwargs: None self.stopAndWaitForServerEnd = _stopAndWaitForServerEnd # wait for start thread: Utils.wait_for(lambda: phase.get('start', None) is not None, MAX_WAITTIME) @@ -333,7 +335,6 @@ def with_foreground_server_thread(startextra={}): # so don't kill (same process) - if success, just wait for end of worker: if phase.get('end', None): th.join() - self.stopAndWaitForServerEnd = None return wrapper return _deco_wrapper