From 55c2a9968a7a4afab43de393f3ce294fe92135ac Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 28 Nov 2017 16:13:37 +0100 Subject: [PATCH] remove lacking [Init] section check ([Init] section not necessary anymore for actions also); fix sporadic error by shutdown server in with_foreground_server_thread decorator (if shutdown too fast, but end-phase still does not reached the tester-thread); --- fail2ban/tests/clientreadertestcase.py | 2 -- fail2ban/tests/fail2banclienttestcase.py | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fail2ban/tests/clientreadertestcase.py b/fail2ban/tests/clientreadertestcase.py index 4b2ec0e5..fdef3735 100644 --- a/fail2ban/tests/clientreadertestcase.py +++ b/fail2ban/tests/clientreadertestcase.py @@ -623,8 +623,6 @@ class JailsReaderTest(LogCaptureTestCase): #print('****', actionName, opts.get('actionstart', '')) self.assertIn('f2b-TEST', opts.get('actionstart', ''), msg="Action file %r: interpolation of actionstart does not contains jail-name 'f2b-TEST'" % actionConfig) - self.assertIn('Init', actionReader.sections(), - msg="Action file %r is lacking [Init] section" % actionConfig) def testReadStockJailConf(self): jails = JailsReader(basedir=CONFIG_DIR, share_config=CONFIG_DIR_SHARE_CFG) # we are running tests from root project dir atm diff --git a/fail2ban/tests/fail2banclienttestcase.py b/fail2ban/tests/fail2banclienttestcase.py index befef926..78a09e81 100644 --- a/fail2ban/tests/fail2banclienttestcase.py +++ b/fail2ban/tests/fail2banclienttestcase.py @@ -312,6 +312,9 @@ def with_foreground_server_thread(startextra={}): finally: DefLogSys.info('=== within server: end. ===') self.pruneLog() + # if seems to be down - try to catch end phase (wait a bit for end:True to recognize down state): + if not phase.get('end', None) and not os.path.exists(pjoin(tmp, "f2b.pid")): + Utils.wait_for(lambda: phase.get('end', None) is not None, MID_WAITTIME) # stop (if still running): if not phase.get('end', None): self.execSuccess(startparams, "stop")