Skip to content

Commit

Permalink
pythongh-95573: Reduce test data size in test_asyncio/test_ssl.py (py…
Browse files Browse the repository at this point in the history
…thonGH-95668)

Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit 3a9e1fd)

Co-authored-by: Fantix King <[email protected]>
  • Loading branch information
fantix authored and miss-islington committed Aug 5, 2022
1 parent 6a36b8e commit 1e3d3e5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Lib/test/test_asyncio/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
import select
import socket
import sys
import tempfile
import threading
import time
Expand All @@ -20,6 +21,10 @@
from test.test_asyncio import utils as test_utils


MACOS = (sys.platform == 'darwin')
BUF_MULTIPLIER = 1024 if not MACOS else 64


def tearDownModule():
asyncio.set_event_loop_policy(None)

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

A_DATA = b'A' * 1024 * 1024
B_DATA = b'B' * 1024 * 1024
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
B_DATA = b'B' * 1024 * BUF_MULTIPLIER

sslctx = self._create_server_ssl_context(
test_utils.ONLYCERT, test_utils.ONLYKEY
Expand Down Expand Up @@ -287,8 +292,8 @@ def test_create_connection_ssl_1(self):
CNT = 0
TOTAL_CNT = 25

A_DATA = b'A' * 1024 * 1024
B_DATA = b'B' * 1024 * 1024
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
B_DATA = b'B' * 1024 * BUF_MULTIPLIER

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

A_DATA = b'A' * 1024 * 1024
B_DATA = b'B' * 1024 * 1024
A_DATA = b'A' * 1024 * BUF_MULTIPLIER
B_DATA = b'B' * 1024 * BUF_MULTIPLIER

sslctx_1 = self._create_server_ssl_context(
test_utils.ONLYCERT, test_utils.ONLYKEY)
Expand Down Expand Up @@ -1178,7 +1183,7 @@ def test_shutdown_cleanly(self):
CNT = 0
TOTAL_CNT = 25

A_DATA = b'A' * 1024 * 1024
A_DATA = b'A' * 1024 * BUF_MULTIPLIER

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

0 comments on commit 1e3d3e5

Please sign in to comment.