mirror of
https://github.com/curl/curl.git
synced 2026-08-25 21:03:34 +03:00
CI: add pytest github workflow to CI test/tests-httpd on a HTTP/3 setup
Closes #10317
This commit is contained in:
parent
d55de24dce
commit
91eb197a9e
5 changed files with 120 additions and 4 deletions
|
|
@ -97,7 +97,7 @@ class TestStuttered:
|
|||
r.check_responses(count=warmups+count, exp_status=200)
|
||||
assert r.total_connects == 1
|
||||
t_avg, i_min, t_min, i_max, t_max = self.stats_spread(r.stats[warmups:], 'time_total')
|
||||
assert t_max < (3 * t_min) and t_min < 2.5, \
|
||||
assert t_max < (2 * t_min), \
|
||||
f'avg time of transfer: {t_avg} [{i_min}={t_min}, {i_max}={t_max}]'
|
||||
|
||||
# download 50 files in 10000 chunks a 1 byte with 10us delay between
|
||||
|
|
@ -122,7 +122,7 @@ class TestStuttered:
|
|||
r.check_responses(count=warmups+count, exp_status=200)
|
||||
assert r.total_connects == 1
|
||||
t_avg, i_min, t_min, i_max, t_max = self.stats_spread(r.stats[warmups:], 'time_total')
|
||||
assert t_max < (3 * t_min) and t_min < 3, \
|
||||
assert t_max < (2 * t_min), \
|
||||
f'avg time of transfer: {t_avg} [{i_min}={t_min}, {i_max}={t_max}]'
|
||||
|
||||
def stats_spread(self, stats: List[Dict], key: str) -> Tuple[float, int, float, int, float]:
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ class CurlClient:
|
|||
self._curl, "-s", "--path-as-is", "-D", self._headerfile,
|
||||
]
|
||||
if self.env.verbose > 2:
|
||||
args.extend(['--trace', self._tracefile])
|
||||
args.extend(['--trace', self._tracefile, '--trace-time'])
|
||||
|
||||
for url in urls:
|
||||
u = urlparse(urls[0])
|
||||
|
|
|
|||
|
|
@ -60,6 +60,8 @@ class Httpd:
|
|||
self.env = env
|
||||
self._cmd = env.apachectl
|
||||
self._apache_dir = os.path.join(env.gen_dir, 'apache')
|
||||
self._run_dir = os.path.join(self._apache_dir, 'run')
|
||||
self._lock_dir = os.path.join(self._apache_dir, 'locks')
|
||||
self._docs_dir = os.path.join(self._apache_dir, 'docs')
|
||||
self._conf_dir = os.path.join(self._apache_dir, 'conf')
|
||||
self._conf_file = os.path.join(self._conf_dir, 'test.conf')
|
||||
|
|
@ -90,9 +92,17 @@ class Httpd:
|
|||
return os.path.exists(self._cmd)
|
||||
|
||||
def _run(self, args, intext=''):
|
||||
env = {}
|
||||
for key, val in os.environ.items():
|
||||
env[key] = val
|
||||
env['APACHE_RUN_DIR'] = self._run_dir
|
||||
env['APACHE_RUN_USER'] = os.environ['USER']
|
||||
env['APACHE_LOCK_DIR'] = self._lock_dir
|
||||
env['APACHE_CONFDIR'] = self._apache_dir
|
||||
p = subprocess.run(args, stderr=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
cwd=self.env.gen_dir,
|
||||
input=intext.encode() if intext else None)
|
||||
input=intext.encode() if intext else None,
|
||||
env=env)
|
||||
start = datetime.now()
|
||||
return ExecResult(args=args, exit_code=p.returncode,
|
||||
stdout=p.stdout.decode().splitlines(),
|
||||
|
|
@ -117,6 +127,7 @@ class Httpd:
|
|||
r = self._apachectl('start')
|
||||
if r.exit_code != 0:
|
||||
log.error(f'failed to start httpd: {r}')
|
||||
return False
|
||||
return self.wait_live(timeout=timedelta(seconds=5))
|
||||
|
||||
def stop(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue