Skip to content

Commit ff88ee4

Browse files
[3.13] gh-148508: Add resilience to SSL preauth tests on iOS (GH-148536) (#148540)
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 a69b14b commit ff88ee4

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
@@ -5268,15 +5268,20 @@ def non_linux_skip_if_other_okay_error(self, err):
52685268
return # Expect the full test setup to always work on Linux.
52695269
if (isinstance(err, ConnectionResetError) or
52705270
(isinstance(err, OSError) and err.errno == errno.EINVAL) or
5271-
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I)):
5271+
re.search('wrong.version.number', str(getattr(err, "reason", "")), re.I) or
5272+
re.search('record.layer.failure', str(getattr(err, "reason", "")), re.I)
5273+
):
52725274
# On Windows the TCP RST leads to a ConnectionResetError
52735275
# (ECONNRESET) which Linux doesn't appear to surface to userspace.
52745276
# If wrap_socket() winds up on the "if connected:" path and doing
5275-
# the actual wrapping... we get an SSLError from OpenSSL. Typically
5276-
# WRONG_VERSION_NUMBER. While appropriate, neither is the scenario
5277-
# we're specifically trying to test. The way this test is written
5278-
# is known to work on Linux. We'll skip it anywhere else that it
5279-
# does not present as doing so.
5277+
# the actual wrapping... we get an SSLError from OpenSSL. This is
5278+
# typically WRONG_VERSION_NUMBER. The same happens on iOS, but
5279+
# RECORD_LAYER_FAILURE is the error.
5280+
#
5281+
# While appropriate, neither is the scenario we're specifically
5282+
# trying to test. The way this test is written is known to work on
5283+
# Linux. We'll skip it anywhere else that it does not present as
5284+
# doing so.
52805285
try:
52815286
self.skipTest(f"Could not recreate conditions on {sys.platform}:"
52825287
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)