mirror of
https://github.com/curl/curl.git
synced 2026-05-30 08:27:28 +03:00
tests: check caddy server version to match test expectations
- new caddy servers no longer return 200 on POSTs, but 405 as they should Closes #13405
This commit is contained in:
parent
1634330474
commit
3e16c97fe9
2 changed files with 17 additions and 2 deletions
|
|
@ -179,4 +179,5 @@ class TestCaddy:
|
|||
url = f'https://{env.domain1}:{caddy.port}/data10.data?[0-{count-1}]'
|
||||
r = curl.http_upload(urls=[url], data=data, alpn_proto=proto,
|
||||
extra_args=['--parallel'])
|
||||
r.check_stats(count=count, http_status=200, exitcode=0)
|
||||
exp_status = 405 if env.caddy_is_at_least('2.7.0') else 200
|
||||
r.check_stats(count=count, http_status=exp_status, exitcode=0)
|
||||
|
|
|
|||
|
|
@ -168,7 +168,11 @@ class EnvConfig:
|
|||
if p.returncode != 0:
|
||||
# not a working caddy
|
||||
self.caddy = None
|
||||
self._caddy_version = re.sub(r' .*', '', p.stdout.strip())
|
||||
m = re.match(r'v?(\d+\.\d+\.\d+) .*', p.stdout)
|
||||
if m:
|
||||
self._caddy_version = m.group(1)
|
||||
else:
|
||||
raise f'Unable to determine cadd version from: {p.stdout}'
|
||||
except:
|
||||
self.caddy = None
|
||||
|
||||
|
|
@ -196,6 +200,12 @@ class EnvConfig:
|
|||
hv = self.versiontuple(self.httpd_version)
|
||||
return hv >= self.versiontuple(minv)
|
||||
|
||||
def caddy_is_at_least(self, minv):
|
||||
if self.caddy_version is None:
|
||||
return False
|
||||
hv = self.versiontuple(self.caddy_version)
|
||||
return hv >= self.versiontuple(minv)
|
||||
|
||||
def is_complete(self) -> bool:
|
||||
return os.path.isfile(self.httpd) and \
|
||||
os.path.isfile(self.apachectl) and \
|
||||
|
|
@ -318,6 +328,10 @@ class Env:
|
|||
def caddy_version() -> str:
|
||||
return Env.CONFIG.caddy_version
|
||||
|
||||
@staticmethod
|
||||
def caddy_is_at_least(minv) -> bool:
|
||||
return Env.CONFIG.caddy_is_at_least(minv)
|
||||
|
||||
@staticmethod
|
||||
def httpd_is_at_least(minv) -> bool:
|
||||
return Env.CONFIG.httpd_is_at_least(minv)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue