From 25b5f1e55767ed587a5f97a94f0c85023c682d21 Mon Sep 17 00:00:00 2001 From: Fantix King Date: Tue, 13 Sep 2022 11:07:11 -0400 Subject: [PATCH] Longer test timeout (#497) * 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 --- .github/workflows/release.yml | 2 +- tests/test_dns.py | 6 ++++-- tests/test_tcp.py | 10 ++++++---- tests/test_unix.py | 13 +++++++++---- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8706c78..ec86556 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/tests/test_dns.py b/tests/test_dns.py index 1240897..f61b1e8 100644 --- a/tests/test_dns.py +++ b/tests/test_dns.py @@ -165,7 +165,8 @@ class BaseTestDNS: 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) @@ -176,7 +177,8 @@ class BaseTestDNS: 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) diff --git a/tests/test_tcp.py b/tests/test_tcp.py index cc03a97..aa86d65 100644 --- a/tests/test_tcp.py +++ b/tests/test_tcp.py @@ -319,7 +319,8 @@ class _TestTCP: 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): @@ -550,7 +551,8 @@ class _TestTCP: 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 @@ -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 @@ -2038,7 +2040,7 @@ class _TestSSL(tb.SSLTestCase): 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 diff --git a/tests/test_unix.py b/tests/test_unix.py index 1c20635..87c1e7e 100644 --- a/tests/test_unix.py +++ b/tests/test_unix.py @@ -10,6 +10,9 @@ import sys 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 @@ -160,7 +163,8 @@ class _TestUnix: 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: @@ -368,7 +372,8 @@ class _TestUnix: 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): @@ -567,7 +572,7 @@ class _TestSSL(tb.SSLTestCase): 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') @@ -628,7 +633,7 @@ class _TestSSL(tb.SSLTestCase): 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,