Skip to content

Commit adb2a3a

Browse files
[3.14] gh-148508: Add resilience to SSL preauth tests on iOS (GH-148536) (#148539)
Adds handling for a test case seen in the iOS SSL tests where an SSL connection fails to handshake correctly. (cherry picked from commit c40e8b0) Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
1 parent d42874a commit adb2a3a

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
@@ -5294,15 +5294,20 @@ def non_linux_skip_if_other_okay_error(self, err):
52945294
return # Expect the full test setup to always work on Linux.
52955295
if (isinstance(err, ConnectionResetError) or
52965296
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5297-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I)):
5297+
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
5298+
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
5299+
):
52985300
# On Windows the TCP RST leads to a ConnectionResetError
52995301
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
53005302
# If wrap_socket() winds up on the "if connected:" path and doing
5301-
# the actual wrapping... we get an SSLError from OpenSSL. Typically
5302-
# WRONG_VERSION_NUMBER. While appropriate, neither is the scenario
5303-
# we're specifically trying to test. The way this test is written
5304-
# is known to work on Linux. We'll skip it anywhere else that it
5305-
# does not present as doing so.
5303+
# the actual wrapping... we get an SSLError from OpenSSL. This is
5304+
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5305+
# RECORD_LAYER_FAILURE is the error.
5306+
#
5307+
# While appropriate, neither is the scenario we're specifically
5308+
# trying to test. The way this test is written is known to work on
5309+
# Linux. We'll skip it anywhere else that it does not present as
5310+
# doing so.
53065311
try:
53075312
self.skipTest(f"Could not recreate conditions on {sys.platform}:"
53085313
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)