Skip to content

Commit

Permalink
Longer test timeout (#497)
Browse files Browse the repository at this point in the history
* Fix tests: 15s SSL_HANDSHAKE_TIMEOUT

Also allow longer time for slow tests on qemu aarch64 for GitHub Actions

* Build sdist on 22.04 to support LoongArch
  • Loading branch information
fantix authored Sep 13, 2022
1 parent 598b16f commit 25b5f1e
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

build-sdist:
needs: validate-release-request
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
Expand Down
6 changes: 4 additions & 2 deletions tests/test_dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ def test_getaddrinfo_18(self):

def test_getaddrinfo_19(self):
# musl always returns ai_canonname while macOS never return for IPs,
# but we strictly follow the docs to use the AI_CANONNAME flag
# but we strictly follow the docs to use the AI_CANONNAME flag in a
# shortcut __static_getaddrinfo_pyaddr()
patch = self.implementation != 'asyncio'

self._test_getaddrinfo('::1', 80)
Expand All @@ -176,7 +177,8 @@ def test_getaddrinfo_19(self):

def test_getaddrinfo_20(self):
# musl always returns ai_canonname while macOS never return for IPs,
# but we strictly follow the docs to use the AI_CANONNAME flag
# but we strictly follow the docs to use the AI_CANONNAME flag in a
# shortcut __static_getaddrinfo_pyaddr()
patch = self.implementation != 'asyncio'

self._test_getaddrinfo('127.0.0.1', 80)
Expand Down
10 changes: 6 additions & 4 deletions tests/test_tcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ def test_create_server_8(self):
ValueError, 'ssl_handshake_timeout is only meaningful'):
self.loop.run_until_complete(
self.loop.create_server(
lambda: None, host='::', port=0, ssl_handshake_timeout=10))
lambda: None, host='::', port=0,
ssl_handshake_timeout=SSL_HANDSHAKE_TIMEOUT))

def test_create_server_9(self):
async def handle_client(reader, writer):
Expand Down Expand Up @@ -550,7 +551,8 @@ def test_create_connection_6(self):
ValueError, 'ssl_handshake_timeout is only meaningful'):
self.loop.run_until_complete(
self.loop.create_connection(
lambda: None, host='::', port=0, ssl_handshake_timeout=10))
lambda: None, host='::', port=0,
ssl_handshake_timeout=SSL_HANDSHAKE_TIMEOUT))

def test_transport_shutdown(self):
CNT = 0 # number of clients that were successful
Expand Down Expand Up @@ -1224,7 +1226,7 @@ class _TestSSL(tb.SSLTestCase):
def test_create_server_ssl_1(self):
CNT = 0 # number of clients that were successful
TOTAL_CNT = 25 # total number of clients that test will create
TIMEOUT = 10.0 # timeout for this test
TIMEOUT = 20.0 # timeout for this test

A_DATA = b'A' * 1024 * 1024
B_DATA = b'B' * 1024 * 1024
Expand Down Expand Up @@ -2038,7 +2040,7 @@ def test_create_server_ssl_over_ssl(self):

CNT = 0 # number of clients that were successful
TOTAL_CNT = 25 # total number of clients that test will create
TIMEOUT = 20.0 # timeout for this test
TIMEOUT = 60.0 # timeout for this test

A_DATA = b'A' * 1024 * 1024
B_DATA = b'B' * 1024 * 1024
Expand Down
13 changes: 9 additions & 4 deletions tests/test_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from uvloop import _testbase as tb


SSL_HANDSHAKE_TIMEOUT = 15.0


class _TestUnix:
def test_create_unix_server_1(self):
CNT = 0 # number of clients that were successful
Expand Down Expand Up @@ -160,7 +163,8 @@ def test_create_unix_server_3(self):
ValueError, 'ssl_handshake_timeout is only meaningful'):
self.loop.run_until_complete(
self.loop.create_unix_server(
lambda: None, path='/tmp/a', ssl_handshake_timeout=10))
lambda: None, path='/tmp/a',
ssl_handshake_timeout=SSL_HANDSHAKE_TIMEOUT))

def test_create_unix_server_existing_path_sock(self):
with self.unix_sock_name() as path:
Expand Down Expand Up @@ -368,7 +372,8 @@ def test_create_unix_connection_6(self):
ValueError, 'ssl_handshake_timeout is only meaningful'):
self.loop.run_until_complete(
self.loop.create_unix_connection(
lambda: None, path='/tmp/a', ssl_handshake_timeout=10))
lambda: None, path='/tmp/a',
ssl_handshake_timeout=SSL_HANDSHAKE_TIMEOUT))


class Test_UV_Unix(_TestUnix, tb.UVTestCase):
Expand Down Expand Up @@ -567,7 +572,7 @@ def prog(sock):
await fut

async def start_server():
extras = dict(ssl_handshake_timeout=10.0)
extras = dict(ssl_handshake_timeout=SSL_HANDSHAKE_TIMEOUT)

with tempfile.TemporaryDirectory() as td:
sock_name = os.path.join(td, 'sock')
Expand Down Expand Up @@ -628,7 +633,7 @@ def server(sock):
sock.close()

async def client(addr):
extras = dict(ssl_handshake_timeout=10.0)
extras = dict(ssl_handshake_timeout=SSL_HANDSHAKE_TIMEOUT)

reader, writer = await asyncio.open_unix_connection(
addr,
Expand Down

0 comments on commit 25b5f1e

Please sign in to comment.