diff options
author | sebres <info@sebres.de> | 2015-07-06 22:04:25 +0200 |
---|---|---|
committer | sebres <info@sebres.de> | 2015-07-06 22:09:13 +0200 |
commit | 4a4fe7d76a4f0438ac5a4cd5af3328330252f9b3 (patch) | |
tree | 87e63a157d7310304a79c50f1145a67dc9e43500 | |
parent | 3e47ce7f2a8b5e16a467a1876c89488622d1a39c (diff) | |
download | fail2ban-_sebres/min-connect-overhead.tar.gz |
extending test cases (increase coverage) + changelog entry for #1099_sebres/min-connect-overhead
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | fail2ban/tests/sockettestcase.py | 16 | ||||
-rw-r--r-- | fail2ban/tests/utils.py | 1 |
3 files changed, 19 insertions, 0 deletions
@@ -26,6 +26,8 @@ ver. 0.9.3 (2015/XX/XXX) - wanna-be-released - Added regex to work with 'userlogins' log * action.d/sendmail*.conf - use LC_ALL (superseeding LC_TIME) to override locale on systems with customized LC_ALL + * performance fix: minimizes connection overhead, close socket only at + communication end (gh-1099) - New Features: * New filters: diff --git a/fail2ban/tests/sockettestcase.py b/fail2ban/tests/sockettestcase.py index 1606d1a4..8eeb7b51 100644 --- a/fail2ban/tests/sockettestcase.py +++ b/fail2ban/tests/sockettestcase.py @@ -25,11 +25,13 @@ __copyright__ = "Copyright (c) 2013 Steven Hiscocks" __license__ = "GPL" import os +import sys import tempfile import threading import time import unittest +from .. import protocol from ..server.asyncserver import AsyncServer, AsyncServerException from ..client.csocket import CSocket @@ -88,3 +90,17 @@ class Socket(unittest.TestCase): self.server.stop() serverThread.join(1) self.assertFalse(os.path.exists(self.sock_name)) + + +class ClientMisc(unittest.TestCase): + + def testPrintFormattedAndWiki(self): + # redirect stdout to devnull + saved_stdout = sys.stdout + sys.stdout = open(os.devnull, 'w') + try: + protocol.printFormatted() + protocol.printWiki() + finally: + # restore stdout + sys.stdout = saved_stdout diff --git a/fail2ban/tests/utils.py b/fail2ban/tests/utils.py index bf992024..89539107 100644 --- a/fail2ban/tests/utils.py +++ b/fail2ban/tests/utils.py @@ -126,6 +126,7 @@ def gatherTests(regexps=None, no_network=False): tests.addTest(unittest.makeSuite(clientreadertestcase.JailsReaderTestCache)) # CSocket and AsyncServer tests.addTest(unittest.makeSuite(sockettestcase.Socket)) + tests.addTest(unittest.makeSuite(sockettestcase.ClientMisc)) # Misc helpers tests.addTest(unittest.makeSuite(misctestcase.HelpersTest)) tests.addTest(unittest.makeSuite(misctestcase.SetupTest)) |