System configuration for the OpenDev Collaboratory
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
4.3 KiB

# 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
# 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.
from util import take_screenshots
testinfra_hosts = ['']
def test_gitea_listening(host):
gitea_https = host.socket("tcp://")
assert gitea_https.is_listening
gitea_http = host.socket("tcp://")
assert gitea_http.is_listening
gitea_ssh = host.socket("tcp://")
assert gitea_ssh.is_listening
gitea_proxy = host.socket("tcp://")
assert gitea_proxy.is_listening
def test_ulimit(host):
cmd ="docker exec gitea-docker_gitea-web_1 prlimit")
expected = ("STACK max stack size "
"16777216 9223372036854775807 bytes")
assert expected in cmd.stdout.split('\n')
def test_robots(host):
cmd ='curl --insecure '
'--resolve '
assert 'Disallow: /' in cmd.stdout
def test_matrix_server(host):
cmd ='curl --insecure -v '
'--resolve '
assert '"m.server": ""' in cmd.stdout
assert 'Access-Control-Allow-Origin' not in cmd.stderr
def test_matrix_client(host):
cmd ='curl --insecure -v '
'--resolve '
assert '"base_url": ""' in cmd.stdout
assert 'Access-Control-Allow-Origin' in cmd.stderr
def test_proxy(host):
cmd ='curl --insecure '
'--resolve '
assert 'Git with a cup of tea' in cmd.stdout
def test_proxy_ua_blacklist(host):
cmd ='curl --insecure -A '
'" Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; TencentTraveler 4.0)" '
'--resolve '
assert '403 Forbidden' in cmd.stdout
def test_ondisk_logs(host):
mariadb_log = host.file('/var/log/containers/docker-mariadb.log')
assert mariadb_log.exists
gitea_log = host.file('/var/log/containers/docker-gitea.log')
assert gitea_log.exists
gitea_ssh_log = host.file('/var/log/containers/docker-gitea-ssh.log')
assert gitea_ssh_log.exists
assert gitea_ssh_log.contains("Server listening on :: port 222.")
def test_project_clone(host):
# Note this tests the result of a project rename in gitea as well.
cmd =
'git clone https://localhost:3081/opendev/disk-image-builder '
assert "Cloning into '/tmp/disk-image-builder'..." in cmd.stderr
assert cmd.succeeded
def test_partial_project_clone(host):
cmd =
'git clone --filter=blob:none '
'https://localhost:3081/opendev/system-config '
assert "Cloning into '/tmp/test-system-config-clone'..." in cmd.stderr
assert cmd.succeeded
def test_gitea_screenshots(host):
shots = (
('https://localhost:3081', None, 'gitea-main.png'),
('https://localhost:3081/opendev/system-config', None,
('https://localhost:3081/opendev/disk-image-builder', None,
('https://localhost:3081/opendev/', None,
('https://localhost:3081/explore/organizations', None,
take_screenshots(host, shots)