Skip to content

Commit 3a9e1fd

Browse files
fantixambv
andauthored
gh-95573: Reduce test data size in test_asyncio/test_ssl.py (GH-95668)
Co-authored-by: Łukasz Langa <[email protected]>
1 parent a525f2a commit 3a9e1fd

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

Lib/test/test_asyncio/test_ssl.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import logging
66
import select
77
import socket
8+
import sys
89
import tempfile
910
import threading
1011
import time
@@ -20,6 +21,10 @@
2021
from test.test_asyncio import utils as test_utils
2122

2223

24+
MACOS = (sys.platform == 'darwin')
25+
BUF_MULTIPLIER = 1024 if not MACOS else 64
26+
27+
2328
def tearDownModule():
2429
asyncio.set_event_loop_policy(None)
2530

@@ -191,8 +196,8 @@ def test_create_server_ssl_1(self):
191196
TOTAL_CNT = 25 # total number of clients that test will create
192197
TIMEOUT = support.LONG_TIMEOUT # timeout for this test
193198

194-
A_DATA = b'A' * 1024 * 1024
195-
B_DATA = b'B' * 1024 * 1024
199+
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
200+
B_DATA = b'B' * 1024 * BUF_MULTIPLIER
196201

197202
sslctx = self._create_server_ssl_context(
198203
test_utils.ONLYCERT, test_utils.ONLYKEY
@@ -287,8 +292,8 @@ def test_create_connection_ssl_1(self):
287292
CNT = 0
288293
TOTAL_CNT = 25
289294

290-
A_DATA = b'A' * 1024 * 1024
291-
B_DATA = b'B' * 1024 * 1024
295+
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
296+
B_DATA = b'B' * 1024 * BUF_MULTIPLIER
292297

293298
sslctx = self._create_server_ssl_context(
294299
test_utils.ONLYCERT,
@@ -1034,8 +1039,8 @@ def test_create_server_ssl_over_ssl(self):
10341039
TOTAL_CNT = 25 # total number of clients that test will create
10351040
TIMEOUT = support.LONG_TIMEOUT # timeout for this test
10361041

1037-
A_DATA = b'A' * 1024 * 1024
1038-
B_DATA = b'B' * 1024 * 1024
1042+
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
1043+
B_DATA = b'B' * 1024 * BUF_MULTIPLIER
10391044

10401045
sslctx_1 = self._create_server_ssl_context(
10411046
test_utils.ONLYCERT, test_utils.ONLYKEY)
@@ -1178,7 +1183,7 @@ def test_shutdown_cleanly(self):
11781183
CNT = 0
11791184
TOTAL_CNT = 25
11801185

1181-
A_DATA = b'A' * 1024 * 1024
1186+
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
11821187

11831188
sslctx = self._create_server_ssl_context(
11841189
test_utils.ONLYCERT, test_utils.ONLYKEY)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
:source:`Lib/test/test_asyncio/test_ssl.py` exposed a bug in the macOS
2+
kernel where intense concurrent load on non-blocking sockets occasionally
3+
causes :const:`errno.ENOBUFS` ("No buffer space available") to be emitted.
4+
FB11063974 filed with Apple, in the mean time as a workaround buffer size
5+
used in tests on macOS is decreased to avoid intermittent failures. Patch
6+
by Fantix King.

0 commit comments

Comments
 (0)