mirror: retwork testinfra testing
This is rather different to all our existing testing, probably because it was just written earlier. Convert this all to curl calls like everything else. Don't use direct IP addresses, but use the hostnames. Drop the --insecure flags as the certificates cover the hostnames now. Also drop the separate ipv6 testing as some hosts don't have ipv6; what we are really interested in is if the apache config is responding correctly, not the test node networking setup. Change-Id: I489055e89bfd8dd05487985dd408767b870c3980
This commit is contained in:
parent
5ba37ced60
commit
ed485c1bbf
@ -21,107 +21,52 @@ def test_apache(host):
|
||||
apache = host.service('apache2')
|
||||
assert apache.is_running
|
||||
|
||||
def _run_cmd(host, port, scheme='https', url=''):
|
||||
hostname = host.backend.get_hostname()
|
||||
return f'curl --resolve {hostname}:127.0.0.1 {scheme}://{hostname}:{port}{url}'
|
||||
|
||||
def test_base_mirror(host):
|
||||
# BaseMirror
|
||||
for addr in host.addr(host.backend.host).ip_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -qO- https://%s/" % addr)
|
||||
# base mirror
|
||||
cmd = host.run(_run_cmd(host, 443))
|
||||
assert '<a href="debian/">' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- http://%s/" % addr)
|
||||
# mirrors still respond on http
|
||||
cmd = host.run(_run_cmd(host, 80, scheme='http'))
|
||||
assert '<a href="debian/">' in cmd.stdout
|
||||
|
||||
def test_proxy_mirror(host):
|
||||
# ProxyMirror
|
||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -qO- "
|
||||
"https://%s:4443/pypi/simple/setuptools" % addr)
|
||||
# pypi proxy mirror
|
||||
cmd = host.run(_run_cmd(host, 4443, url='/pypi/simple/setuptools'))
|
||||
assert 'setuptools' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- "
|
||||
"http://%s:8080/pypi/simple/setuptools" % addr)
|
||||
assert 'setuptools' in cmd.stdout
|
||||
|
||||
# split the test cases so that we can escape the ipv6 addrs properly
|
||||
for addr in host.addr(host.backend.host).ipv6_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -qO- "
|
||||
"https://[%s]:4443/pypi/simple/setuptools" % addr)
|
||||
assert 'setuptools' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- "
|
||||
"http://[%s]:8080/pypi/simple/setuptools" % addr)
|
||||
cmd = host.run(_run_cmd(host, 8080, scheme='http', url='/pypi/simple/setuptools'))
|
||||
assert 'setuptools' in cmd.stdout
|
||||
|
||||
def test_dockerv2_mirror(host):
|
||||
# Dockerv2Mirror
|
||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -O- "
|
||||
"https://%s:4445/v2/" % addr)
|
||||
assert '401 Unauthorized' in cmd.stderr
|
||||
# Docker v2 mirror
|
||||
|
||||
cmd = host.run("wget -O- http://%s:8082/v2/" %addr)
|
||||
assert '401 Unauthorized' in cmd.stderr
|
||||
# NOTE(ianw) 2022-07 : this gets back a 401 .json; maybe something
|
||||
# better we could do?
|
||||
cmd = host.run(_run_cmd(host, 4445, url='/v2/'))
|
||||
assert 'UNAUTHORIZED' in cmd.stdout
|
||||
|
||||
for addr in host.addr(host.backend.host).ipv6_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -O- "
|
||||
"https://[%s]:4445/v2/" % addr)
|
||||
assert '401 Unauthorized' in cmd.stderr
|
||||
|
||||
cmd = host.run("wget -O- http://[%s]:8082/v2/" %addr)
|
||||
assert '401 Unauthorized' in cmd.stderr
|
||||
cmd = host.run(_run_cmd(host, 8082, scheme='http', url='/v2/'))
|
||||
assert 'UNAUTHORIZED' in cmd.stdout
|
||||
|
||||
def test_quay_mirror(host):
|
||||
# QuayRegistryMirror
|
||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -qO- "
|
||||
"https://%s:4447/" % addr)
|
||||
assert 'quay' in cmd.stdout
|
||||
cmd = host.run(_run_cmd(host, 4447, url='/'))
|
||||
assert 'Quay' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- http://%s:8084/" % addr)
|
||||
assert 'quay' in cmd.stdout
|
||||
|
||||
for addr in host.addr(host.backend.host).ipv6_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -qO- "
|
||||
"https://[%s]:4447/" % addr)
|
||||
assert 'quay' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- http://[%s]:8084/" % addr)
|
||||
assert 'quay' in cmd.stdout
|
||||
cmd = host.run(_run_cmd(host, 8084, scheme='http', url='/'))
|
||||
assert 'Quay' in cmd.stdout
|
||||
|
||||
# TODO test RHRegistryMirror
|
||||
|
||||
def test_galaxy_mirror(host):
|
||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
||||
cmd = host.run(
|
||||
"wget --no-check-certificate -qO- https://%s/galaxy/" % addr)
|
||||
cmd = host.run(_run_cmd(host, 443, url='/galaxy/'))
|
||||
assert 'Ansible Galaxy' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- http://%s/galaxy/" % addr)
|
||||
cmd = host.run(_run_cmd(host, 80, scheme='http', url='/galaxy/'))
|
||||
assert 'Ansible Galaxy' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget --no-check-certificate -O- "
|
||||
"https://%s/galaxy/download/community-general-4.0.2.tar.gz" %
|
||||
addr)
|
||||
assert '/galaxy-s3/artifact/' in cmd.stderr
|
||||
|
||||
cmd = host.run("wget -O- "
|
||||
"http://%s/galaxy/download/community-general-4.0.2.tar.gz" %
|
||||
addr)
|
||||
assert '/galaxy-s3/artifact/' in cmd.stderr
|
||||
|
||||
for addr in host.addr(host.backend.host).ipv6_addresses:
|
||||
cmd = host.run("wget --no-check-certificate -qO- "
|
||||
"https://[%s]/galaxy/" % addr)
|
||||
assert 'Ansible Galaxy' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget -qO- http://[%s]/galaxy/" % addr)
|
||||
assert 'Ansible Galaxy' in cmd.stdout
|
||||
|
||||
cmd = host.run("wget --no-check-certificate -O- "
|
||||
"https://[%s]/galaxy/download/community-general-4.0.2.tar.gz" %
|
||||
addr)
|
||||
assert '/galaxy-s3/artifact/' in cmd.stderr
|
||||
|
||||
cmd = host.run("wget -O- "
|
||||
"http://[%s]/galaxy/download/community-general-4.0.2.tar.gz" %
|
||||
addr)
|
||||
assert '/galaxy-s3/artifact/' in cmd.stderr
|
||||
|
Loading…
Reference in New Issue
Block a user