system-config/testinfra/test_static.py
Ian Wienand 3206fd02b8 static: move afs sites from files.openstack.org to static.opendev.org
This creates sites to serve

 developer.openstack.org
 docs.openstack.org
 docs.opendev.org
 docs.starlingx.io

which are all just static directories underneath /afs/openstack.org/.

This is currently done by files02.openstack.org, but will be better
served in the future by consolidating in ansible configuration on
static.opendev.org.

The following dns entries need to be made before merging to ensure the
certificates are provisioned

 _acme-challenge.developer.openstack.org
 _acme-challenge.docs.openstack.org
 _acme-challenge.docs.opendev.org
 _acme-challenge.docs.starlingx.io

Once done, we can merge and then cut-over the main DNS entries as we
like.

Since there are some follow-ons, I have not removed the puppet
configuration from files02.openstack.org.  I think it's best we
migrate everything away from that and remove it in one lot.

Change-Id: I459a36f823a8868e6cc09e2b0d85f2fe05d69002
2020-02-21 17:59:14 +01:00

117 lines
4.4 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.
import pytest
testinfra_hosts = ['static01.opendev.org']
def test_apache(host):
apache = host.service('apache2')
assert apache.is_running
def test_static_opendev_org(host):
cmd = host.run('curl --insecure '
'--resolve static.opendev.org:443:127.0.0.1 '
'https://static.opendev.org/')
assert 'Index of /' in cmd.stdout
def test_governance_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve governance.openstack.org:443:127.0.0.1 '
'https://governance.openstack.org/')
assert 'OpenStack Governance' in cmd.stdout
def test_security_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve security.openstack.org:443:127.0.0.1 '
'https://security.openstack.org/')
assert 'OpenStack Security Project' in cmd.stdout
def test_tarballs_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve tarballs.openstack.org:443:127.0.0.1 '
'--resolve tarballs.opendev.org:443:127.0.0.1 '
'https://tarballs.openstack.org/nova/')
# The redirect page should send us to tarballs.opendev.org
assert '302 Found' in cmd.stdout
assert 'https://tarballs.opendev.org/openstack/nova/' in cmd.stdout
def test_tarballs_opendev_org(host):
cmd = host.run('curl --insecure '
'--resolve tarballs.opendev.org:443:127.0.0.1 '
'https://tarballs.opendev.org/openstack/nova/')
# An old file that should be present
assert 'nova-12.0.0.tar.gz' in cmd.stdout
def test_specs_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve specs.openstack.org:443:127.0.0.1 '
'https://specs.openstack.org/specs.opml')
assert 'OpenStack Specs Feeds' in cmd.stdout
def test_service_types_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve service-types.openstack.org:443:127.0.0.1 '
'https://service-types.openstack.org')
assert 'OpenStack Service Types Authority Data' in cmd.stdout
def test_releases_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve releases.openstack.org:443:127.0.0.1 '
'https://releases.openstack.org')
assert 'OpenStack Releases: OpenStack Releases' in cmd.stdout
def test_developer_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve developer.openstack.org:443:127.0.0.1 '
'https://developer.openstack.org')
assert 'OpenStack Docs: Application Development' in cmd.stdout
def test_docs_openstack_org(host):
cmd = host.run('curl --insecure '
'--resolve docs.openstack.org:443:127.0.0.1 '
'https://docs.openstack.org')
# links to the latest, make sure it redirected us
assert '301 Moved Permanently' in cmd.stdout
def test_docs_opendev_org(host):
cmd = host.run('curl --insecure '
'--resolve docs.opendev.org:443:127.0.0.1 '
'https://docs.opendev.org')
assert 'Index of /' in cmd.stdout
def test_docs_starlingx_io(host):
cmd = host.run('curl --insecure '
'--resolve docs.starlingx.io:443:127.0.0.1 '
'https://docs.starlingx.io')
# links to the latest, make sure it redirected us
assert 'StarlingX Docs: Welcome to the StarlingX Documentation' \
in cmd.stdout
zuul_names = (
'zuul-ci.org',
'www.zuul-ci.org',
'zuulci.org',
'www.zuulci.org',
)
@pytest.mark.parametrize("name", zuul_names)
def test_docs_openstack_org(host, name):
cmd = host.run('curl --insecure '
'--resolve %s:443:127.0.0.1 https://%s/ ' %
(name, name))
assert 'Zuul is an open source CI tool' in cmd.stdout