From 01db0b502854f23ae9bd23906ccc0e48b80f0465 Mon Sep 17 00:00:00 2001 From: sebres Date: Sat, 21 Jan 2017 17:54:01 +0100 Subject: [PATCH] small performance fix after merge with 0.10 (cherry picked from commit 8e2711681cf0f65ca5d3ef6831246ec5d4973c21) --- fail2ban/tests/action_d/test_smtp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fail2ban/tests/action_d/test_smtp.py b/fail2ban/tests/action_d/test_smtp.py index 0aeacbae..8334f948 100644 --- a/fail2ban/tests/action_d/test_smtp.py +++ b/fail2ban/tests/action_d/test_smtp.py @@ -82,10 +82,11 @@ class SMTPActionTest(unittest.TestCase): self._active = False self._loop_thread.join() - def _exec_and_wait(self, doaction): + def _exec_and_wait(self, doaction, timeout=3, short=False): + if short: timeout /= 25 self.smtpd.ready = False doaction() - Utils.wait_for(lambda: self.smtpd.ready, 3) + Utils.wait_for(lambda: self.smtpd.ready, timeout) def testStart(self): self._exec_and_wait(self.action.start) @@ -114,7 +115,7 @@ class SMTPActionTest(unittest.TestCase): if restored: aInfo['restored'] = 1 - self._exec_and_wait(lambda: self.action.ban(aInfo)) + self._exec_and_wait(lambda: self.action.ban(aInfo), short=restored) if restored: # no mail, should raises attribute error: self.assertRaises(AttributeError, lambda: self.smtpd.mailfrom) return