2018-08-30 16:00:46 -07:00
|
|
|
# Copyright 2018 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.
|
|
|
|
|
2020-03-03 12:30:20 +11:00
|
|
|
import pytest
|
2018-08-30 16:00:46 -07:00
|
|
|
|
2021-03-16 15:21:58 -07:00
|
|
|
testinfra_hosts = ['nl01.opendev.org', 'nb01.opendev.org']
|
2018-08-30 16:00:46 -07:00
|
|
|
|
|
|
|
|
|
|
|
def test_clouds_yaml(host):
|
2020-05-07 13:06:26 +10:00
|
|
|
cfg_file = '/etc/openstack/clouds.yaml'
|
2020-03-16 10:01:14 +11:00
|
|
|
clouds_yaml = host.file(cfg_file)
|
2018-08-30 16:00:46 -07:00
|
|
|
assert clouds_yaml.exists
|
|
|
|
|
|
|
|
assert b'password' in clouds_yaml.content
|
2018-11-28 16:19:40 -08:00
|
|
|
|
|
|
|
def test_kube_config(host):
|
2020-04-16 10:18:51 -05:00
|
|
|
if not host.backend.get_hostname().startswith('nl'):
|
2020-03-03 12:30:20 +11:00
|
|
|
pytest.skip()
|
2018-11-28 16:19:40 -08:00
|
|
|
kubeconfig = host.file('/home/nodepool/.kube/config')
|
|
|
|
assert kubeconfig.exists
|
|
|
|
|
2019-02-06 15:38:10 -08:00
|
|
|
assert b'nodepool_k8s_key' in kubeconfig.content
|
2020-03-03 12:30:20 +11:00
|
|
|
|
2020-04-16 10:18:51 -05:00
|
|
|
def test_launcher_container_running(host):
|
2021-03-16 15:21:58 -07:00
|
|
|
if host.backend.get_hostname() != 'nl01.opendev.org':
|
2020-04-16 10:18:51 -05:00
|
|
|
pytest.skip()
|
|
|
|
|
|
|
|
cmd = host.run("docker ps -a --format '{{ .Names }}'")
|
|
|
|
assert 'nodepool-docker_nodepool-launcher_1' in cmd.stdout
|
|
|
|
|
2020-03-03 12:30:20 +11:00
|
|
|
def test_builder_container_running(host):
|
2020-09-18 11:12:04 -07:00
|
|
|
if host.backend.get_hostname() != 'nb01.opendev.org':
|
2020-03-03 12:30:20 +11:00
|
|
|
pytest.skip()
|
|
|
|
|
2020-03-14 11:05:31 -05:00
|
|
|
cmd = host.run("docker ps -a --format '{{ .Names }}'")
|
2020-04-13 08:58:17 -07:00
|
|
|
assert 'nodepool-builder-compose_nodepool-builder_1' in cmd.stdout
|
2020-03-06 12:08:09 +11:00
|
|
|
|
|
|
|
def test_builder_webserver_running(host):
|
2020-09-18 11:12:04 -07:00
|
|
|
if host.backend.get_hostname() != 'nb01.opendev.org':
|
2020-03-06 12:08:09 +11:00
|
|
|
pytest.skip()
|
|
|
|
|
|
|
|
apache = host.service('apache2')
|
|
|
|
assert apache.is_running
|
|
|
|
|
|
|
|
cmd = host.run('curl --insecure '
|
2020-09-18 11:12:04 -07:00
|
|
|
'--resolve nb01.opendev.org:443:127.0.0.1 '
|
|
|
|
'https://nb01.opendev.org/')
|
2020-03-06 12:08:09 +11:00
|
|
|
assert 'Index of /' in cmd.stdout
|