system-config/testinfra/test_etherpad.py
Clark Boylan ed1c7c94a3 Make etherpad configuration more generic for multiple hosts
This switches us to running the services against the etherpad group. We
also define vars in a group_vars file rather than a host specific
file. This allows us to switch testing over to etherpad99 to decouple it
from our production hostnames.

A followup change will add a new etherpad production server that will be
deployed alongside the existing one. This refactor makes that a bit
simpler.

Change-Id: I838ad31eb74a3abfd02bbfa77c9c2d007d57a3d4
2023-04-05 08:36:27 -07:00

37 lines
1.3 KiB
Python

# 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.
testinfra_hosts = ['etherpad99.opendev.org']
def test_etherpad_listening(host):
etherpad = host.socket("tcp://127.0.0.1:9001")
assert etherpad.is_listening
def test_etherpad_robots(host):
cmd = host.run('curl --insecure '
'--resolve etherpad.opendev.org:443:127.0.0.1 '
'https://etherpad.opendev.org/robots.txt')
assert 'Disallow: /' in cmd.stdout
def test_etherpad_logs(host):
etherpad_log_file = host.file('/var/log/containers/docker-etherpad.log')
assert etherpad_log_file.exists
assert etherpad_log_file.contains('Etherpad is running')
mariadb_log_file = host.file('/var/log/containers/docker-mariadb.log')
assert mariadb_log_file.exists
assert mariadb_log_file.contains('mysqld: ready for connections')