system-config/testinfra/test_gerrit.py
Clark Boylan d3875c1867 Add Gerrit 3.11 image builds and testing
This adds Gerrit 3.11 image builds an a system-config-run job for a 3.11
deployment. We don't add 3.10 to 3.11 upgrade testing yet. This will
happen as a followup once we're happy with general image building and
testing.

This adds explicit push and force push permissions to the Administrators
group via code reviewed changes. The reason for this is Gerrit 3.11 has
decided that everything should be code reviewed by default including
actions by Administrators. Since we're just doing this for bootstrapping
of testing we quickly add the old expected permissions back via code
review.

This has a side effect of bumping up the change numbers for the cahnges
we care about in review up by 2 integer values. The tests and
screenshots are all updated to accomodate the shift in change numbers.

Change-Id: Ib7090563a869577ed100ca71c496e8779e5b1010
2024-12-09 16:34:50 -08:00

74 lines
2.7 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.
import time
from util import take_screenshots
testinfra_hosts = [
'review99.opendev.org',
]
def test_gerrit_listening(host):
gerrit_web = host.socket("tcp://:::8081")
assert gerrit_web.is_listening
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
assert cmd.succeeded
def test_gerrit_screenshot(host):
# 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/+/3', script,
'gerrit-change-page-3.png'),
('http://localhost:8081/c/x/test-project/+/4', script,
'gerrit-change-page-4.png')
)
take_screenshots(host, shots)
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
def test_openinfra_cla(host):
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
assert 'OpenInfra Foundation Individual Contributor License Agreement' in cmd.stdout
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