From 904d175d19cc1d68747dd122950b687c4c7439ad Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Mon, 13 Mar 2023 10:20:22 -0700 Subject: [PATCH] Test old and new Gerrit This change updates the CI testing for git-review to test with Gerrit 3.4.4 and 3.7.1. This should give us good coverage of new and old Gerrit behavior when making changes to git-review. Note we leave 3.4.4 as the default in the test suite for local runs to try and limit possibility of breaking old Gerrit when adding features to git-review for new Gerrit. Change-Id: I4a42eddec1e247cbb0af5e74b8f1cee0ad58a79a --- .zuul.yaml | 32 ++++++++++++++++++++++++++++---- git_review/tests/__init__.py | 14 ++++++++------ 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.zuul.yaml b/.zuul.yaml index 00fdb8bb..84979740 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,27 @@ +- job: + name: nox-py36-gerrit-default + parent: nox-py36 + nodeset: ubuntu-bionic + +- job: + name: nox-py36-gerrit-371 + parent: nox-py36-gerrit-default + vars: + nox_environment: + WAR_URL: 'https://gerrit-releases.storage.googleapis.com/gerrit-3.7.1.war' + +- job: + name: nox-py311-gerrit-default + parent: nox-py311 + nodeset: ubuntu-jammy + +- job: + name: nox-py311-gerrit-371 + parent: nox-py311-gerrit-default + vars: + nox_environment: + WAR_URL: 'https://gerrit-releases.storage.googleapis.com/gerrit-3.7.1.war' + - project: vars: release_python: python3 @@ -7,10 +31,10 @@ jobs: &jobs - build-python-release - nox-linters - - nox-py36: - nodeset: ubuntu-bionic - - nox-py311: - nodeset: ubuntu-jammy + - nox-py36-gerrit-default + - nox-py36-gerrit-371 + - nox-py311-gerrit-default + - nox-py311-gerrit-371 gate: jobs: *jobs promote: diff --git a/git_review/tests/__init__.py b/git_review/tests/__init__.py index 913458c8..971b3aa7 100644 --- a/git_review/tests/__init__.py +++ b/git_review/tests/__init__.py @@ -37,9 +37,11 @@ else: urlparse = urllib.parse.urlparse -WAR_URL = 'https://gerrit-releases.storage.googleapis.com/gerrit-3.4.4.war' +DEFAULT_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) +# DEFAULT_WAR_URL changes. Set new value to something unique (just +1 it for +# example). GOLDEN_SITE_VER = '7' @@ -108,12 +110,12 @@ class IsoEnvDir(DirHelpers, fixtures.Fixture): class GerritHelpers(DirHelpers): - def init_dirs(self): self.primary_dir = os.path.abspath(os.path.curdir) self.gerrit_dir = self._dir('primary', '.gerrit') self.gsite_dir = self._dir('gerrit', 'golden_site') - self.gerrit_war = self._dir('gerrit', WAR_URL.split('/')[-1]) + self.war_url = os.environ.get('WAR_URL', DEFAULT_WAR_URL) + self.gerrit_war = self._dir('gerrit', self.war_url.split('/')[-1]) def ensure_gerrit_war(self): # check if gerrit.war file exists in .gerrit directory @@ -121,8 +123,8 @@ class GerritHelpers(DirHelpers): os.mkdir(self.gerrit_dir) if not os.path.exists(self.gerrit_war): - print("Downloading Gerrit binary from %s..." % WAR_URL) - resp = requests.get(WAR_URL) + print("Downloading Gerrit binary from %s..." % self.war_url) + resp = requests.get(self.war_url) if resp.status_code != 200: raise RuntimeError("Problem requesting Gerrit war") utils.write_to_file(self.gerrit_war, resp.content)