Skip to content

Commit c40e8b0

Browse files
authored
gh-148508: Add resilience to SSL preauth tests on iOS (#148536)
Adds handling for a test case seen in the iOS SSL tests where an SSL connection fails to handshake correctly.
1 parent eb4c78d commit c40e8b0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Lib/test/test_ssl.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5566,15 +5566,20 @@ def non_linux_skip_if_other_okay_error(self, err):
55665566
return # Expect the full test setup to always work on Linux.
55675567
if (isinstance(err, ConnectionResetError) or
55685568
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5569-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I)):
5569+
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
5570+
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
5571+
):
55705572
# On Windows the TCP RST leads to a ConnectionResetError
55715573
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
55725574
# If wrap_socket() winds up on the "if connected:" path and doing
5573-
# the actual wrapping... we get an SSLError from OpenSSL. Typically
5574-
# WRONG_VERSION_NUMBER. While appropriate, neither is the scenario
5575-
# we're specifically trying to test. The way this test is written
5576-
# is known to work on Linux. We'll skip it anywhere else that it
5577-
# does not present as doing so.
5575+
# the actual wrapping... we get an SSLError from OpenSSL. This is
5576+
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5577+
# RECORD_LAYER_FAILURE is the error.
5578+
#
5579+
# While appropriate, neither is the scenario we're specifically
5580+
# trying to test. The way this test is written is known to work on
5581+
# Linux. We'll skip it anywhere else that it does not present as
5582+
# doing so.
55785583
try:
55795584
self.skipTest(f"Could not recreate conditions on {sys.platform}:"
55805585
f" {err=}")
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
An intermittent timing error when running SSL tests on iOS has been
2+
resolved.

0 commit comments

Comments
 (0)