Upgrade testing to Gerrit 3.4.4

An addition has been proposed to leverage Gerrit's "Cc" feature, but
in order to test this we need a newer version of the server.

Newer Gerrit versions require HTTP basic auth instead of digest for
the REST API, so switch our tests to use that when uploading SSH
keys.

A newer JDK (11) is required, but this version should still be
available on our configured test platforms.

We update the test Gerrit server config to not try to send email. This
prevents annoying tracebacks from ending up in the Gerrit logs on test
failures.

We update test_cloned_repo and test_multiple_changes to look for strings
that newer Gerrit emits on successful push. Git review passes these
through to users and the tests look for them to determine if pushes were
successful.

Because of an SSH host key negotiation regression in 3.4.5, stick
with 3.4.4 for now:

https://bugs.chromium.org/p/gerrit/issues/detail?id=16215

Finally we remove skipsdist from tox.ini so that `which git-review` can
find git-review installed to the test venv. Tox v4 won't install the
project into the venv if skipsdist is set.

Change-Id: I540950b93356b1efbc34bca976bfb3134f47a599
This commit is contained in:
Jeremy Stanley 2022-07-11 14:34:26 +00:00 committed by Clark Boylan
parent e2382507ed
commit 4c6ab44916
5 changed files with 13 additions and 11 deletions

View File

@ -2,4 +2,4 @@
# install and tests; see http://docs.opendev.org/opendev/bindep/ for additional
# information.
openjdk-8-jdk [test]
openjdk-11-jdk [test]

View File

@ -37,10 +37,10 @@ else:
urlparse = urllib.parse.urlparse
WAR_URL = 'https://gerrit-releases.storage.googleapis.com/gerrit-2.13.14.war'
WAR_URL = 'https://gerrit-releases.storage.googleapis.com/gerrit-3.4.4.war'
# Update GOLDEN_SITE_VER for every change altering golden site, including
# WAR_URL changes. Set new value to something unique (just +1 it for example)
GOLDEN_SITE_VER = '5'
GOLDEN_SITE_VER = '6'
# NOTE(yorik-sar): This function needs to be a perfect hash function for
@ -225,7 +225,7 @@ class BaseGitReviewTestCase(testtools.TestCase, GerritHelpers):
pub_key = pub_key_fd.read().decode().strip()
resp = requests.post(
'http://%s:%s/a/accounts/self/sshkeys' % (http_addr, http_port),
auth=requests.auth.HTTPDigestAuth('admin', 'secret'),
auth=requests.auth.HTTPBasicAuth('admin', 'secret'),
headers={'Content-Type': 'text/plain'},
data=pub_key)
if resp.status_code != 201:

View File

@ -65,7 +65,9 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
"""Test git-review on the just cloned repository."""
self._simple_change('test file modified', 'test commit message')
self.assertNotIn('Change-Id:', self._run_git('log', '-1'))
self.assertIn('remote: New Changes:', self._run_git_review())
gr = self._run_git_review()
self.assertIn('remote: SUCCESS', gr)
self.assertIn('test commit message [NEW]', gr)
self.assertIn('Change-Id:', self._run_git('log', '-1'))
def test_git_review_s(self):
@ -237,7 +239,10 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
self._simple_change('test file modified 4th time',
'test commit message 4')
review_res = self._run_git_review('-y')
self.assertIn("Processing changes: new: 2", review_res)
self.assertIn("Processing changes: refs: 1, new: 2", review_res)
self.assertIn("remote: SUCCESS", review_res)
self.assertIn("test commit message 3 [NEW]", review_res)
self.assertIn("test commit message 4 [NEW]", review_res)
def test_git_review_re(self):
"""Test git-review adding reviewers to changes."""

View File

@ -31,6 +31,8 @@ GERRIT_CONF_TMPL = """
listenAddress = %s:%s
[httpd]
listenUrl = http://%s:%s/
[sendemail]
enable = false
"""

View File

@ -1,11 +1,6 @@
[tox]
envlist = linters,docs,py3
ignore_basepython_conflict = true
# We skipsdist to force test-requirements and specifically pbr
# to be installed prior to installing git-review. This ensures that
# easy_install doesn't try to talk to pypi.org for pbr which fails
# on older python due to a lack of SNI support.
skipsdist = true
[testenv]
basepython = python3