unify tests for early data, check for ngtcp2 when testing h3

This commit is contained in:
Stefan Eissing 2025-02-25 15:49:57 +01:00
parent cbbdfd32e7
commit da5453381f
No known key found for this signature in database
4 changed files with 21 additions and 15 deletions

View File

@ -577,12 +577,10 @@ class TestDownload:
@pytest.mark.skipif(condition=not Env.have_nghttpx(), reason="no nghttpx")
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
def test_02_32_earlydata(self, env: Env, httpd, nghttpx, proto):
if not env.curl_uses_lib('gnutls') and \
not env.curl_uses_lib('wolfssl') and \
not env.curl_uses_lib('quictls') and \
not env.curl_uses_lib('openssl'):
if not env.curl_can_early_data():
pytest.skip('TLS earlydata not implemented')
if proto == 'h3' and not env.have_h3():
if proto == 'h3' and \
(not env.have_h3() or not env.curl_can_h3_early_data()):
pytest.skip("h3 not supported")
count = 2
docname = 'data-10k'

View File

@ -703,12 +703,10 @@ class TestUpload:
# of 128K.
])
def test_07_70_put_earlydata(self, env: Env, httpd, nghttpx, proto, upload_size, exp_early):
if not env.curl_uses_lib('gnutls') and \
not env.curl_uses_lib('wolfssl') and \
not env.curl_uses_lib('quictls') and \
not env.curl_uses_lib('openssl'):
if not env.curl_can_early_data():
pytest.skip('TLS earlydata not implemented')
if proto == 'h3' and not env.have_h3():
if proto == 'h3' and \
(not env.have_h3() or not env.curl_can_h3_early_data()):
pytest.skip("h3 not supported")
count = 2
# we want this test to always connect to nghttpx, since it is

View File

@ -207,12 +207,10 @@ class TestCaddy:
@pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
def test_08_08_earlydata(self, env: Env, httpd, caddy, proto):
if not env.curl_uses_lib('gnutls') and \
not env.curl_uses_lib('wolfssl') and \
not env.curl_uses_lib('quictls') and \
not env.curl_uses_lib('openssl'):
if not env.curl_can_early_data():
pytest.skip('TLS earlydata not implemented')
if proto == 'h3' and not env.have_h3():
if proto == 'h3' and \
(not env.have_h3() or not env.curl_can_h3_early_data()):
pytest.skip("h3 not supported")
count = 2
docname = 'data10k.data'

View File

@ -382,6 +382,18 @@ class Env:
def curl_is_debug() -> bool:
return Env.CONFIG.curl_is_debug
@staticmethod
def curl_can_early_data() -> bool:
return Env.curl_uses_lib('gnutls') or \
Env.curl_uses_lib('wolfssl') or \
Env.curl_uses_lib('quictls') or \
Env.curl_uses_lib('openssl')
@staticmethod
def curl_can_h3_early_data() -> bool:
return Env.curl_can_early_data() and \
Env.curl_uses_lib('ngtcp2')
@staticmethod
def have_h3() -> bool:
return Env.have_h3_curl() and Env.have_h3_server()