@ -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 )
assert ' <a href= " debian/ " > ' in cmd . stdout
# base mirror
cmd = host . run ( _run_cmd ( host , 443 ) )
assert ' <a href= " debian/ " > ' in cmd . stdout
cmd = host . run ( " wget -qO- http:// %s / " % addr )
assert ' <a href= " debian/ " > ' in cmd . stdout
# 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 )
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 )
assert ' setuptools ' in cmd . stdout
# pypi proxy mirror
cmd = host . run ( _run_cmd ( host , 4443 , 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
cmd = host . run ( _run_cmd ( host , 8080 , scheme = ' http ' , url = ' /pypi/simple/setuptools ' ) )
assert ' setuptools ' in cmd . stdout
cmd = host . run ( " wget -O- http:// %s :8082/v2/ " % addr )
assert ' 401 Unauthorized ' in cmd . stder r
def test_dockerv2_mirror ( host ) :
# Docker v2 mirror
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
# 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
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 ( " wget -qO- http:// %s :8084/ " % addr )
assert ' quay ' in cmd . stdout
cmd = host . run ( _run_cmd ( host , 4447 , url = ' / ' ) )
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 )
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
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
cmd = host . run ( _run_cmd ( host , 443 , url = ' /galaxy/ ' ) )
assert ' Ansible Galaxy ' in cmd . stdout
cmd = host . run ( _run_cmd ( host , 80 , scheme = ' http ' , url = ' /galaxy/ ' ) )
assert ' Ansible Galaxy ' in cmd . stdout