Skip to content

Commit

Permalink
Fixes skupperproject#1204: retry connection attempt in test_002_clien…
Browse files Browse the repository at this point in the history
…t_cert_fail test
  • Loading branch information
kgiusti committed Sep 19, 2023
1 parent e673261 commit 262a882
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/system_tests_http1_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from system_test import TIMEOUT, AsyncTestSender, AsyncTestReceiver
from system_test import retry_exception, curl_available, run_curl, retry
from system_test import nginx_available, get_digest, NginxServer, Process
from system_test import openssl_available
from system_test import openssl_available, is_pattern_present
from http1_tests import http1_ping, TestServer, RequestHandler10
from http1_tests import RequestMsg, ResponseMsg, ResponseValidator
from http1_tests import ThreadedTestClient, Http1OneRouterTestBase
Expand Down Expand Up @@ -2676,9 +2676,15 @@ def test_002_client_cert_fail(self):
server.settimeout(TIMEOUT)
server.bind(("localhost", server_port))
server.listen(1)
self.assertRaises(OSError, server.accept)

router.wait_log_message(pattern=r"TLS connection failed")
# ISSUE-1204: occasionally the accept fails before the TLS handshake
# even runs, which fails the test since the log message will not be
# issued in that case. Retry until handshake fails
def _try_handshake(self):
self.assertRaises(OSError, server.accept)
with open(router.logfile_path, 'rt') as out_file:
return is_pattern_present(out_file, r"TLS connection failed")
self.assertTrue(retry(lambda: _try_handshake(self)))

# Ensure router can still connect given the proper TLS config.

Expand Down

0 comments on commit 262a882

Please sign in to comment.