mirror of
https://github.com/curl/curl.git
synced 2026-08-12 21:20:57 +03:00
pytest: skip H2 tests if feature missing from curl
To allow running pytests on more curl configurations. Also delete a redundant H3 feature check from test_17_14_expired_cert. Cherry-picked from #19407 Closes #19412
This commit is contained in:
parent
7e0d4dd4a8
commit
3752de465d
16 changed files with 294 additions and 2 deletions
|
|
@ -56,6 +56,8 @@ class TestBasic:
|
|||
# simple https: GET, h2 wanted and got
|
||||
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
|
||||
def test_01_03_h2_get(self, env: Env, httpd):
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.domain1}:{env.https_port}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2'])
|
||||
|
|
@ -65,6 +67,8 @@ class TestBasic:
|
|||
# simple https: GET, h2 unsupported, fallback to h1
|
||||
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
|
||||
def test_01_04_h2_unsupported(self, env: Env, httpd):
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.domain2}:{env.https_port}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2'])
|
||||
|
|
@ -84,6 +88,8 @@ class TestBasic:
|
|||
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
||||
def test_01_06_timings(self, env: Env, httpd, nghttpx, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
if proto == 'h3' and not env.have_h3():
|
||||
pytest.skip("h3 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
|
|
@ -100,6 +106,8 @@ class TestBasic:
|
|||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
||||
@pytest.mark.skipif(condition=not Env.have_ssl_curl(), reason="curl without SSL")
|
||||
def test_01_07_head(self, env: Env, httpd, nghttpx, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
if proto == 'h3' and not env.have_h3():
|
||||
pytest.skip("h3 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
|
|
@ -115,6 +123,8 @@ class TestBasic:
|
|||
|
||||
# http: GET for HTTP/2, see Upgrade:, 101 switch
|
||||
def test_01_08_h2_upgrade(self, env: Env, httpd):
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url = f'http://{env.domain1}:{env.http_port}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2'])
|
||||
|
|
@ -127,6 +137,8 @@ class TestBasic:
|
|||
|
||||
# http: GET for HTTP/2 with prior knowledge
|
||||
def test_01_09_h2_prior_knowledge(self, env: Env, httpd):
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url = f'http://{env.domain1}:{env.http_port}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2-prior-knowledge'])
|
||||
|
|
@ -138,6 +150,8 @@ class TestBasic:
|
|||
|
||||
# http: strip TE header in HTTP/2 requests
|
||||
def test_01_10_te_strip(self, env: Env, httpd):
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.authority_for(env.domain1, "h2")}/data.json'
|
||||
r = curl.http_get(url=url, extra_args=['--http2', '-H', 'TE: gzip'])
|
||||
|
|
@ -152,6 +166,8 @@ class TestBasic:
|
|||
# RSTing the stream correctly when its internal limits are exceeded.
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
||||
def test_01_11_large_resp_headers(self, env: Env, httpd, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
if proto == 'h3' and not env.have_h3():
|
||||
pytest.skip("h3 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
|
|
@ -167,6 +183,8 @@ class TestBasic:
|
|||
reason='httpd must be at least 2.4.64')
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
||||
def test_01_12_xlarge_resp_headers(self, env: Env, httpd, configures_httpd, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
httpd.set_extra_config('base', [
|
||||
f'H2MaxHeaderBlockLen {130 * 1024}',
|
||||
])
|
||||
|
|
@ -184,6 +202,8 @@ class TestBasic:
|
|||
reason='httpd must be at least 2.4.64')
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
||||
def test_01_13_megalarge_resp_headers(self, env: Env, httpd, configures_httpd, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
httpd.set_extra_config('base', [
|
||||
'LogLevel http2:trace2',
|
||||
f'H2MaxHeaderBlockLen {130 * 1024}',
|
||||
|
|
@ -204,6 +224,8 @@ class TestBasic:
|
|||
reason='httpd must be at least 2.4.64')
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
||||
def test_01_14_gigalarge_resp_headers(self, env: Env, httpd, configures_httpd, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
httpd.set_extra_config('base', [
|
||||
'LogLevel http2:trace2',
|
||||
f'H2MaxHeaderBlockLen {1024 * 1024}',
|
||||
|
|
@ -223,6 +245,8 @@ class TestBasic:
|
|||
reason='httpd must be at least 2.4.64')
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2'])
|
||||
def test_01_15_gigalarge_resp_headers(self, env: Env, httpd, configures_httpd, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
httpd.set_extra_config('base', [
|
||||
'LogLevel http2:trace2',
|
||||
f'H2MaxHeaderBlockLen {1024 * 1024}',
|
||||
|
|
@ -240,6 +264,8 @@ class TestBasic:
|
|||
# http: invalid request headers, GET, issue #16998
|
||||
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
|
||||
def test_01_16_inv_req_get(self, env: Env, httpd, nghttpx, proto):
|
||||
if proto == 'h2' and not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
if proto == 'h3' and not env.have_h3():
|
||||
pytest.skip("h3 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
|
|
@ -263,6 +289,8 @@ class TestBasic:
|
|||
])
|
||||
def test_01_17_TE(self, env: Env, httpd, te_in, te_out):
|
||||
proto = 'h2'
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url = f'https://{env.authority_for(env.domain1, proto)}/curltest/echo'
|
||||
r = curl.http_download(urls=[url], alpn_proto=proto, with_stats=True,
|
||||
|
|
@ -277,6 +305,8 @@ class TestBasic:
|
|||
# check that an existing https: connection is not reused for http:
|
||||
def test_01_18_tls_reuse(self, env: Env, httpd):
|
||||
proto = 'h2'
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url1 = f'https://{env.authority_for(env.domain1, proto)}/data.json'
|
||||
url2 = f'http://{env.authority_for(env.domain1, proto)}/data.json'
|
||||
|
|
@ -287,6 +317,8 @@ class TestBasic:
|
|||
# check that an existing http: connection is not reused for https:
|
||||
def test_01_19_plain_reuse(self, env: Env, httpd):
|
||||
proto = 'h2'
|
||||
if not env.have_h2_curl():
|
||||
pytest.skip("h2 not supported")
|
||||
curl = CurlClient(env=env)
|
||||
url1 = f'http://{env.domain1}:{env.http_port}/data.json'
|
||||
url2 = f'https://{env.domain1}:{env.http_port}/data.json'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue