summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Stanley <fungi@yuggoth.org>2022-07-11 14:34:26 +0000
committerClark Boylan <clark.boylan@gmail.com>2023-03-07 15:56:59 -0800
commit4c6ab4491670c7b98da9105cfe9f6d121a8a5bf4 (patch)
tree869ad1812cc4d660864f7c3fee44b53b1cd58193
parente2382507ed080556c70b5166ed195f2edc05eae4 (diff)
downloadgit-review-4c6ab4491670c7b98da9105cfe9f6d121a8a5bf4.tar.gz
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
-rw-r--r--bindep.txt2
-rw-r--r--git_review/tests/__init__.py6
-rw-r--r--git_review/tests/test_git_review.py9
-rw-r--r--git_review/tests/utils.py2
-rw-r--r--tox.ini5
5 files changed, 13 insertions, 11 deletions
diff --git a/bindep.txt b/bindep.txt
index ef605c8..9c35486 100644
--- a/bindep.txt
+++ b/bindep.txt
@@ -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]
diff --git a/git_review/tests/__init__.py b/git_review/tests/__init__.py
index 545495e..c274cde 100644
--- a/git_review/tests/__init__.py
+++ b/git_review/tests/__init__.py
@@ -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:
diff --git a/git_review/tests/test_git_review.py b/git_review/tests/test_git_review.py
index dcb9232..0e643aa 100644
--- a/git_review/tests/test_git_review.py
+++ b/git_review/tests/test_git_review.py
@@ -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."""
diff --git a/git_review/tests/utils.py b/git_review/tests/utils.py
index 10013f7..edd9deb 100644
--- a/git_review/tests/utils.py
+++ b/git_review/tests/utils.py
@@ -31,6 +31,8 @@ GERRIT_CONF_TMPL = """
listenAddress = %s:%s
[httpd]
listenUrl = http://%s:%s/
+[sendemail]
+ enable = false
"""
diff --git a/tox.ini b/tox.ini
index 66148bc..3543c94 100644
--- a/tox.ini
+++ b/tox.ini
@@ -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