0613cfda31
Ansible Galaxy indexes tarballs of Ansible roles and collections at a central site, which in turn points to a dedicated Amazon S3 subdomain. The tools which consume it support overriding the default Galaxy URL with any arbitrary one, so should be able to take advantage of this in CI jobs. Change-Id: Ib5664e5588f7237a19a2cdb6eec3109452e8a107
128 lines
4.8 KiB
Python
128 lines
4.8 KiB
Python
# Copyright 2019 Red Hat, Inc.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
# not use this file except in compliance with the License. You may obtain
|
|
# a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
# License for the specific language governing permissions and limitations
|
|
# under the License.
|
|
|
|
|
|
testinfra_hosts = ['mirror01.openafs.provider.opendev.org',
|
|
'mirror02.openafs.provider.opendev.org']
|
|
|
|
|
|
def test_apache(host):
|
|
apache = host.service('apache2')
|
|
assert apache.is_running
|
|
|
|
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
|
|
|
|
cmd = host.run("wget -qO- http://%s/" % addr)
|
|
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
|
|
|
|
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("wget -O- http://%s:8082/v2/" %addr)
|
|
assert '401 Unauthorized' in cmd.stderr
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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
|