Commit 97f4a5fb authored by Jérome Perrin's avatar Jérome Perrin

software/proftpd/test: relax assertion on TestBanLog

We observed some test failures like for example 1 where this assertion
was failing because message is `Error reading SSH protocol banner`.

Because the purpose of this specific test is to check that log rotation
of ban log work as expected and because we test more thoroughly the
ban itself in TestBan.test_client_are_banned_after_5_wrong_passwords, we
can simplify this test by just asserting that connection was refused, by
expecting a general exception. We don't care about the details of the
exception here.

After a ban, the first connection attemps seem to always be refused with
"Connection reset by peer" and that's why we did not observed failures
with TestBan.test_client_are_banned_after_5_wrong_passwords

[1]: https://nexedijs.erp5.net/#/test_result_module/20211208-1520AC26C/21
parent aa6f42e2
...@@ -476,6 +476,5 @@ class TestBanLog(ProFTPdTestCase, LogRotationMixin): ...@@ -476,6 +476,5 @@ class TestBanLog(ProFTPdTestCase, LogRotationMixin):
expected_logged_text = 'denied due to host ban' expected_logged_text = 'denied due to host ban'
def _access(self) -> None: def _access(self) -> None:
for _ in range(6): for _ in range(6):
with self.assertRaisesRegex( with self.assertRaises(Exception):
Exception, '(Authentication failed|Connection reset by peer)'):
self._getConnection(password='wrong') self._getConnection(password='wrong')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment