2019-01-31 09:26:38 -08: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-12-03 11:54:48 +11:00
|
|
|
import time
|
2019-01-31 09:26:38 -08:00
|
|
|
|
2021-09-07 10:47:38 +10:00
|
|
|
from util import take_screenshots
|
|
|
|
|
2019-10-25 12:09:29 +09:00
|
|
|
testinfra_hosts = [
|
2021-10-12 09:26:44 -07:00
|
|
|
'review99.opendev.org',
|
2019-10-25 12:09:29 +09:00
|
|
|
]
|
2019-01-31 09:26:38 -08:00
|
|
|
|
|
|
|
|
|
|
|
def test_gerrit_listening(host):
|
|
|
|
gerrit_web = host.socket("tcp://:::8081")
|
|
|
|
assert gerrit_web.is_listening
|
2020-12-03 11:54:48 +11:00
|
|
|
|
2021-01-29 08:46:02 -08:00
|
|
|
def test_gerrit_x_project_clone(host):
|
|
|
|
cmd = host.run(
|
|
|
|
'git clone http://localhost:8081/x/test-project /tmp/test-project')
|
|
|
|
assert "Cloning into '/tmp/test-project'..." in cmd.stderr
|
2021-02-01 08:16:21 -08:00
|
|
|
assert cmd.succeeded
|
2021-01-29 08:46:02 -08:00
|
|
|
|
2020-12-03 11:54:48 +11:00
|
|
|
def test_gerrit_screenshot(host):
|
2021-01-28 13:52:08 +11:00
|
|
|
|
2021-09-07 10:47:38 +10:00
|
|
|
# Click the gerrit results tab into view
|
|
|
|
script = ("document.querySelector('gr-app').shadowRoot"
|
|
|
|
".querySelector('gr-app-element').shadowRoot"
|
|
|
|
".querySelector('main')"
|
|
|
|
".querySelector('gr-change-view').shadowRoot"
|
|
|
|
".querySelector('paper-tab[data-name=\"change-view-tab-header-zuul-results-summary\"]')"
|
|
|
|
".click()")
|
|
|
|
|
|
|
|
shots = (
|
|
|
|
('http://localhost:8081', None, 'gerrit-main-page.png'),
|
|
|
|
('http://localhost:8081/c/x/test-project/+/1', script,
|
|
|
|
'gerrit-change-page-1.png'),
|
|
|
|
('http://localhost:8081/c/x/test-project/+/2', script,
|
|
|
|
'gerrit-change-page-2.png')
|
|
|
|
)
|
|
|
|
|
|
|
|
take_screenshots(host, shots)
|
2021-09-27 13:28:26 -07:00
|
|
|
|
|
|
|
def test_opendev_logo(host):
|
|
|
|
cmd = host.run('curl --head --insecure '
|
|
|
|
'--resolve review.opendev.org:443:127.0.0.1 '
|
|
|
|
'https://review.opendev.org/static/opendev-sm.png')
|
|
|
|
assert '200 OK' in cmd.stdout
|
|
|
|
assert 'Content-Type: image/png' in cmd.stdout
|
|
|
|
|
2021-10-07 09:58:14 -07:00
|
|
|
def test_openinfra_cla(host):
|
2021-09-27 13:28:26 -07:00
|
|
|
cmd = host.run('curl --include --insecure '
|
|
|
|
'--resolve review.opendev.org:443:127.0.0.1 '
|
|
|
|
'https://review.opendev.org/static/cla.html')
|
|
|
|
assert '200 OK' in cmd.stdout
|
|
|
|
assert 'Content-Type: text/html' in cmd.stdout
|
2021-10-07 09:58:14 -07:00
|
|
|
assert 'OpenInfra Foundation Individual Contributor License Agreement' in cmd.stdout
|
2022-02-18 18:42:12 +00:00
|
|
|
|
|
|
|
def test_gitiles_blocked(host):
|
|
|
|
cmd = host.run('curl --include --insecure '
|
|
|
|
'--resolve review.opendev.org:443:127.0.0.1 '
|
|
|
|
'https://review.opendev.org/plugins/gitiles/opendev/system-config/')
|
|
|
|
assert '403 Forbidden' in cmd.stdout
|