mirror of
https://github.com/curl/curl.git
synced 2026-08-26 05:23:33 +03:00
pytest-xdist: pytest in parallel
Require now pytest-xdist from tests/http/requirements.txt and run pytest in 'auto' parallel mode (counts cpu cores). For CI runs, set the worker count to 4, overriding the core count of 2 exposed in the images. - use Filelock to generate allocated ports at start for all workers and have subsequent workers just read the file and take the ports for their slot - make httpd config clearing a function fixture so every test starts with a clean httpd config - have fixture `configures_httpd` as parameter of test cases that configure httpd anyway, saving one reload - add pytest-xdist and filelock to required pyhton modules - add installs to ruff CI - give live checks waiting for a server to start up longer time - add fixtures to tests that rely on a server - do not stop servers unnecessarily. failures may not start them properly again, leading to unexpected fails in whatever follows - add a https: port to httpd that is *not* back by QUIC to allow failover tests without stopping the QUIC server Closes #17295
This commit is contained in:
parent
f0bf43e209
commit
30ef79ed93
39 changed files with 644 additions and 449 deletions
|
|
@ -47,8 +47,9 @@ class TestProxy:
|
|||
nghttpx_fwd.start_if_needed()
|
||||
env.make_data_file(indir=env.gen_dir, fname="data-100k", fsize=100*1024)
|
||||
env.make_data_file(indir=env.gen_dir, fname="data-10m", fsize=10*1024*1024)
|
||||
httpd.clear_extra_configs()
|
||||
httpd.reload()
|
||||
indir = httpd.docs_dir
|
||||
env.make_data_file(indir=indir, fname="data-100k", fsize=100*1024)
|
||||
env.make_data_file(indir=indir, fname="data-1m", fsize=1024*1024)
|
||||
|
||||
def get_tunnel_proto_used(self, r: ExecResult):
|
||||
for line in r.trace_lines:
|
||||
|
|
@ -110,7 +111,7 @@ class TestProxy:
|
|||
assert respdata == indata
|
||||
|
||||
# download http: via http: proxytunnel
|
||||
def test_10_03_proxytunnel_http(self, env: Env, httpd):
|
||||
def test_10_03_proxytunnel_http(self, env: Env, httpd, nghttpx_fwd):
|
||||
curl = CurlClient(env=env)
|
||||
url = f'http://localhost:{env.http_port}/data.json'
|
||||
xargs = curl.get_proxy_args(proxys=False, tunnel=True)
|
||||
|
|
@ -133,7 +134,7 @@ class TestProxy:
|
|||
# download https: with proto via http: proxytunnel
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
||||
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
|
||||
def test_10_05_proxytunnel_http(self, env: Env, httpd, proto):
|
||||
def test_10_05_proxytunnel_http(self, env: Env, httpd, nghttpx_fwd, proto):
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://localhost:{env.https_port}/data.json'
|
||||
xargs = curl.get_proxy_args(proxys=False, tunnel=True)
|
||||
|
|
@ -258,7 +259,7 @@ class TestProxy:
|
|||
url = f'https://localhost:{env.https_port}/data.json'
|
||||
proxy_args = curl.get_proxy_args(tunnel=True, proto=tunnel)
|
||||
r1 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=proxy_args)
|
||||
extra_args=proxy_args)
|
||||
r1.check_response(count=1, http_status=200)
|
||||
assert self.get_tunnel_proto_used(r1) == 'HTTP/2' \
|
||||
if tunnel == 'h2' else 'HTTP/1.1'
|
||||
|
|
@ -267,7 +268,7 @@ class TestProxy:
|
|||
x2_args.append('--next')
|
||||
x2_args.extend(proxy_args)
|
||||
r2 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=x2_args)
|
||||
extra_args=x2_args)
|
||||
r2.check_response(count=2, http_status=200)
|
||||
assert r2.total_connects == 1
|
||||
|
||||
|
|
@ -283,7 +284,7 @@ class TestProxy:
|
|||
url = f'https://localhost:{env.https_port}/data.json'
|
||||
proxy_args = curl.get_proxy_args(tunnel=True, proto=tunnel)
|
||||
r1 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=proxy_args)
|
||||
extra_args=proxy_args)
|
||||
r1.check_response(count=1, http_status=200)
|
||||
assert self.get_tunnel_proto_used(r1) == 'HTTP/2' \
|
||||
if tunnel == 'h2' else 'HTTP/1.1'
|
||||
|
|
@ -293,7 +294,7 @@ class TestProxy:
|
|||
x2_args.extend(proxy_args)
|
||||
x2_args.extend(['--proxy-tls13-ciphers', 'TLS_AES_256_GCM_SHA384'])
|
||||
r2 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=x2_args)
|
||||
extra_args=x2_args)
|
||||
r2.check_response(count=2, http_status=200)
|
||||
assert r2.total_connects == 2
|
||||
|
||||
|
|
@ -309,7 +310,7 @@ class TestProxy:
|
|||
url = f'http://localhost:{env.http_port}/data.json'
|
||||
proxy_args = curl.get_proxy_args(tunnel=True, proto=tunnel)
|
||||
r1 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=proxy_args)
|
||||
extra_args=proxy_args)
|
||||
r1.check_response(count=1, http_status=200)
|
||||
assert self.get_tunnel_proto_used(r1) == 'HTTP/2' \
|
||||
if tunnel == 'h2' else 'HTTP/1.1'
|
||||
|
|
@ -319,7 +320,7 @@ class TestProxy:
|
|||
x2_args.extend(proxy_args)
|
||||
x2_args.extend(['--proxy-tls13-ciphers', 'TLS_AES_256_GCM_SHA384'])
|
||||
r2 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=x2_args)
|
||||
extra_args=x2_args)
|
||||
r2.check_response(count=2, http_status=200)
|
||||
assert r2.total_connects == 2
|
||||
|
||||
|
|
@ -335,7 +336,7 @@ class TestProxy:
|
|||
url = f'https://localhost:{env.https_port}/data.json'
|
||||
proxy_args = curl.get_proxy_args(tunnel=True, proto=tunnel)
|
||||
r1 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=proxy_args)
|
||||
extra_args=proxy_args)
|
||||
r1.check_response(count=1, http_status=200)
|
||||
assert self.get_tunnel_proto_used(r1) == 'HTTP/2' \
|
||||
if tunnel == 'h2' else 'HTTP/1.1'
|
||||
|
|
@ -345,7 +346,7 @@ class TestProxy:
|
|||
x2_args.extend(proxy_args)
|
||||
x2_args.extend(['--tls13-ciphers', 'TLS_AES_256_GCM_SHA384'])
|
||||
r2 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True,
|
||||
extra_args=x2_args)
|
||||
extra_args=x2_args)
|
||||
r2.check_response(count=2, http_status=200)
|
||||
assert r2.total_connects == 2
|
||||
|
||||
|
|
@ -364,7 +365,7 @@ class TestProxy:
|
|||
extra_args=xargs)
|
||||
if env.curl_uses_lib('mbedtls') and \
|
||||
not env.curl_lib_version_at_least('mbedtls', '3.5.0'):
|
||||
r.check_exit_code(60) # CURLE_PEER_FAILED_VERIFICATION
|
||||
r.check_exit_code(60) # CURLE_PEER_FAILED_VERIFICATION
|
||||
else:
|
||||
r.check_response(count=1, http_status=200,
|
||||
protocol='HTTP/2' if proto == 'h2' else 'HTTP/1.1')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue