Merge "mirror: retwork testinfra testing"
This commit is contained in:
commit
9d5136fdf9
@ -21,107 +21,52 @@ def test_apache(host):
|
|||||||
apache = host.service('apache2')
|
apache = host.service('apache2')
|
||||||
assert apache.is_running
|
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):
|
def test_base_mirror(host):
|
||||||
# BaseMirror
|
# base mirror
|
||||||
for addr in host.addr(host.backend.host).ip_addresses:
|
cmd = host.run(_run_cmd(host, 443))
|
||||||
cmd = host.run("wget --no-check-certificate -qO- https://%s/" % addr)
|
|
||||||
assert '<a href="debian/">' in cmd.stdout
|
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
|
assert '<a href="debian/">' in cmd.stdout
|
||||||
|
|
||||||
def test_proxy_mirror(host):
|
def test_proxy_mirror(host):
|
||||||
# ProxyMirror
|
# pypi proxy mirror
|
||||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
cmd = host.run(_run_cmd(host, 4443, url='/pypi/simple/setuptools'))
|
||||||
cmd = host.run("wget --no-check-certificate -qO- "
|
|
||||||
"https://%s:4443/pypi/simple/setuptools" % addr)
|
|
||||||
assert 'setuptools' in cmd.stdout
|
assert 'setuptools' in cmd.stdout
|
||||||
|
|
||||||
cmd = host.run("wget -qO- "
|
cmd = host.run(_run_cmd(host, 8080, scheme='http', url='/pypi/simple/setuptools'))
|
||||||
"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)
|
|
||||||
assert 'setuptools' in cmd.stdout
|
assert 'setuptools' in cmd.stdout
|
||||||
|
|
||||||
def test_dockerv2_mirror(host):
|
def test_dockerv2_mirror(host):
|
||||||
# Dockerv2Mirror
|
# Docker v2 mirror
|
||||||
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
|
|
||||||
|
|
||||||
cmd = host.run("wget -O- http://%s:8082/v2/" %addr)
|
# NOTE(ianw) 2022-07 : this gets back a 401 .json; maybe something
|
||||||
assert '401 Unauthorized' in cmd.stderr
|
# 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(_run_cmd(host, 8082, scheme='http', url='/v2/'))
|
||||||
cmd = host.run("wget --no-check-certificate -O- "
|
assert 'UNAUTHORIZED' in cmd.stdout
|
||||||
"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
|
|
||||||
|
|
||||||
def test_quay_mirror(host):
|
def test_quay_mirror(host):
|
||||||
# QuayRegistryMirror
|
# QuayRegistryMirror
|
||||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
cmd = host.run(_run_cmd(host, 4447, url='/'))
|
||||||
cmd = host.run("wget --no-check-certificate -qO- "
|
assert 'Quay' in cmd.stdout
|
||||||
"https://%s:4447/" % addr)
|
|
||||||
assert 'quay' in cmd.stdout
|
|
||||||
|
|
||||||
cmd = host.run("wget -qO- http://%s:8084/" % addr)
|
cmd = host.run(_run_cmd(host, 8084, scheme='http', url='/'))
|
||||||
assert 'quay' in cmd.stdout
|
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
|
|
||||||
|
|
||||||
# TODO test RHRegistryMirror
|
# TODO test RHRegistryMirror
|
||||||
|
|
||||||
def test_galaxy_mirror(host):
|
def test_galaxy_mirror(host):
|
||||||
for addr in host.addr(host.backend.host).ipv4_addresses:
|
cmd = host.run(_run_cmd(host, 443, url='/galaxy/'))
|
||||||
cmd = host.run(
|
|
||||||
"wget --no-check-certificate -qO- https://%s/galaxy/" % addr)
|
|
||||||
assert 'Ansible Galaxy' in cmd.stdout
|
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
|
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…
x
Reference in New Issue
Block a user