ed485c1bbf
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
73 lines
2.3 KiB
Python
73 lines
2.3 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 _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):
|
|
# base mirror
|
|
cmd = host.run(_run_cmd(host, 443))
|
|
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):
|
|
# pypi proxy mirror
|
|
cmd = host.run(_run_cmd(host, 4443, url='/pypi/simple/setuptools'))
|
|
assert 'setuptools' in cmd.stdout
|
|
|
|
cmd = host.run(_run_cmd(host, 8080, scheme='http', url='/pypi/simple/setuptools'))
|
|
assert 'setuptools' in cmd.stdout
|
|
|
|
def test_dockerv2_mirror(host):
|
|
# Docker v2 mirror
|
|
|
|
# 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(_run_cmd(host, 8082, scheme='http', url='/v2/'))
|
|
assert 'UNAUTHORIZED' in cmd.stdout
|
|
|
|
def test_quay_mirror(host):
|
|
# QuayRegistryMirror
|
|
cmd = host.run(_run_cmd(host, 4447, url='/'))
|
|
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):
|
|
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
|
|
|