parent
e923ba8371
commit
3df6a1af69
@ -0,0 +1,65 @@
|
||||
From 781a25512b107828aff71998c19f2fa4dbf471c1 Mon Sep 17 00:00:00 2001
|
||||
From: "Sergey G. Brester" <serg.brester@sebres.de>
|
||||
Date: Fri, 6 Mar 2020 19:04:39 +0100
|
||||
Subject: [PATCH 1/4] travis CI: add 3.9-dev as target
|
||||
|
||||
---
|
||||
.travis.yml | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/fail2ban/server/jailthread.py
|
||||
+++ b/fail2ban/server/jailthread.py
|
||||
@@ -120,3 +120,6 @@ class JailThread(Thread):
|
||||
## python 2.x replace binding of private __bootstrap method:
|
||||
if sys.version_info < (3,): # pragma: 3.x no cover
|
||||
JailThread._Thread__bootstrap = JailThread._JailThread__bootstrap
|
||||
+## python 3.9, restore isAlive method:
|
||||
+elif not hasattr(JailThread, 'isAlive'): # pragma: 2.x no cover
|
||||
+ JailThread.isAlive = JailThread.is_alive
|
||||
--- a/fail2ban/tests/sockettestcase.py
|
||||
+++ b/fail2ban/tests/sockettestcase.py
|
||||
@@ -87,7 +87,7 @@ class Socket(LogCaptureTestCase):
|
||||
def _stopServerThread(self):
|
||||
serverThread = self.serverThread
|
||||
# wait for end of thread :
|
||||
- Utils.wait_for(lambda: not serverThread.isAlive()
|
||||
+ Utils.wait_for(lambda: not serverThread.is_alive()
|
||||
or serverThread.join(Utils.DEFAULT_SLEEP_TIME), unittest.F2B.maxWaitTime(10))
|
||||
self.serverThread = None
|
||||
|
||||
@@ -98,7 +98,7 @@ class Socket(LogCaptureTestCase):
|
||||
self.server.close()
|
||||
# wait for end of thread :
|
||||
self._stopServerThread()
|
||||
- self.assertFalse(serverThread.isAlive())
|
||||
+ self.assertFalse(serverThread.is_alive())
|
||||
# clean :
|
||||
self.server.stop()
|
||||
self.assertFalse(self.server.isActive())
|
||||
@@ -139,7 +139,7 @@ class Socket(LogCaptureTestCase):
|
||||
self.server.stop()
|
||||
# wait for end of thread :
|
||||
self._stopServerThread()
|
||||
- self.assertFalse(serverThread.isAlive())
|
||||
+ self.assertFalse(serverThread.is_alive())
|
||||
self.assertFalse(self.server.isActive())
|
||||
self.assertFalse(os.path.exists(self.sock_name))
|
||||
|
||||
@@ -180,7 +180,7 @@ class Socket(LogCaptureTestCase):
|
||||
self.server.stop()
|
||||
# wait for end of thread :
|
||||
self._stopServerThread()
|
||||
- self.assertFalse(serverThread.isAlive())
|
||||
+ self.assertFalse(serverThread.is_alive())
|
||||
|
||||
def testLoopErrors(self):
|
||||
# replace poll handler to produce error in loop-cycle:
|
||||
@@ -216,7 +216,7 @@ class Socket(LogCaptureTestCase):
|
||||
self.server.stop()
|
||||
# wait for end of thread :
|
||||
self._stopServerThread()
|
||||
- self.assertFalse(serverThread.isAlive())
|
||||
+ self.assertFalse(serverThread.is_alive())
|
||||
self.assertFalse(self.server.isActive())
|
||||
self.assertFalse(os.path.exists(self.sock_name))
|
||||
|
@ -0,0 +1,54 @@
|
||||
From 343ec1cdd296530f331637c725bd2bb0549e01e6 Mon Sep 17 00:00:00 2001
|
||||
From: sebres <serg.brester@sebres.de>
|
||||
Date: Wed, 18 Mar 2020 20:37:25 +0100
|
||||
Subject: [PATCH] test-causes: avoid host-depending issue (mistakenly ignoring
|
||||
IP 127.0.0.2 as own address) - replace loop-back addr with test sub-net addr
|
||||
(and disable ignoreself)
|
||||
|
||||
---
|
||||
fail2ban/tests/observertestcase.py | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/fail2ban/tests/observertestcase.py b/fail2ban/tests/observertestcase.py
|
||||
index 8e9444548..e379ccd18 100644
|
||||
--- a/fail2ban/tests/observertestcase.py
|
||||
+++ b/fail2ban/tests/observertestcase.py
|
||||
@@ -36,7 +36,6 @@
|
||||
from ..server.observer import Observers, ObserverThread
|
||||
from ..server.utils import Utils
|
||||
from .utils import LogCaptureTestCase
|
||||
-from ..server.filter import Filter
|
||||
from .dummyjail import DummyJail
|
||||
|
||||
from .databasetestcase import getFail2BanDb, Fail2BanDb
|
||||
@@ -224,7 +223,7 @@ def testBanTimeIncr(self):
|
||||
jail.actions.setBanTime(10)
|
||||
jail.setBanTimeExtra('increment', 'true')
|
||||
jail.setBanTimeExtra('multipliers', '1 2 4 8 16 32 64 128 256 512 1024 2048')
|
||||
- ip = "127.0.0.2"
|
||||
+ ip = "192.0.2.1"
|
||||
# used as start and fromtime (like now but time independence, cause test case can run slow):
|
||||
stime = int(MyTime.time())
|
||||
ticket = FailTicket(ip, stime, [])
|
||||
@@ -385,10 +384,12 @@ def testBanTimeIncr(self):
|
||||
|
||||
# two separate jails :
|
||||
jail1 = DummyJail(backend='polling')
|
||||
+ jail1.filter.ignoreSelf = False
|
||||
jail1.setBanTimeExtra('increment', 'true')
|
||||
jail1.database = self.db
|
||||
self.db.addJail(jail1)
|
||||
jail2 = DummyJail(name='DummyJail-2', backend='polling')
|
||||
+ jail2.filter.ignoreSelf = False
|
||||
jail2.database = self.db
|
||||
self.db.addJail(jail2)
|
||||
ticket1 = FailTicket(ip, stime, [])
|
||||
@@ -477,7 +478,7 @@ def testObserver(self):
|
||||
self.assertEqual(tickets, [])
|
||||
|
||||
# add failure:
|
||||
- ip = "127.0.0.2"
|
||||
+ ip = "192.0.2.1"
|
||||
ticket = FailTicket(ip, stime-120, [])
|
||||
failManager = FailManager()
|
||||
failManager.setMaxRetry(3)
|
Loading…
Reference in new issue