pytest fixes and improvements

- fix test_17_20 flakiness: the test case did not have `nghttpx` in
  its parameters, causing it to no check if a reload was necessary.
  When that test ran behind one that gave nghttpx another certificate,
  eg. in parallel mode, it used the wrong pinned pubkey.
- Have `env` provide lists of HTTP protocol versions available for
  testing. Replace parameterized tests on a fixed protocol list with
  the dynamic one from env. This makes checks for protocol availability
  in the test function bodies superfluous.

refs #19489
Closes #19540
This commit is contained in:
Stefan Eissing 2025-11-15 12:45:54 +01:00 committed by Daniel Stenberg
parent b3d4f17e3d
commit 217f0e4d59
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
17 changed files with 191 additions and 630 deletions

View file

@ -506,6 +506,36 @@ class Env:
return Env.curl_can_early_data() and \
Env.curl_uses_lib('ngtcp2')
@staticmethod
def http_protos() -> List[str]:
# http protocols we can test
if Env.have_h2_curl():
if Env.have_h3():
return ['http/1.1', 'h2', 'h3']
else:
return ['http/1.1', 'h2']
else:
return ['http/1.1']
@staticmethod
def http_h1_h2_protos() -> List[str]:
# http 1+2 protocols we can test
if Env.have_h2_curl():
return ['http/1.1', 'h2']
else:
return ['http/1.1']
@staticmethod
def http_mplx_protos() -> List[str]:
# http multiplexing protocols we can test
if Env.have_h2_curl():
if Env.have_h3():
return ['h2', 'h3']
else:
return ['h2']
else:
return []
@staticmethod
def have_h3() -> bool:
return Env.have_h3_curl() and Env.have_h3_server()
@ -560,7 +590,8 @@ class Env:
def issue_certs(self):
if self._ca is None:
ca_dir = os.path.join(self.CONFIG.gen_root, 'ca')
# ca_dir = os.path.join(self.CONFIG.gen_root, 'ca')
ca_dir = os.path.join(self.gen_dir, 'ca')
os.makedirs(ca_dir, exist_ok=True)
lock_file = os.path.join(ca_dir, 'ca.lock')
with FileLock(lock_file):