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
This commit is contained in:
Clark Boylan 2023-03-13 10:20:22 -07:00
parent fcd9de135b
commit 904d175d19
2 changed files with 36 additions and 10 deletions

View File

@ -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: - project:
vars: vars:
release_python: python3 release_python: python3
@ -7,10 +31,10 @@
jobs: &jobs jobs: &jobs
- build-python-release - build-python-release
- nox-linters - nox-linters
- nox-py36: - nox-py36-gerrit-default
nodeset: ubuntu-bionic - nox-py36-gerrit-371
- nox-py311: - nox-py311-gerrit-default
nodeset: ubuntu-jammy - nox-py311-gerrit-371
gate: gate:
jobs: *jobs jobs: *jobs
promote: promote:

View File

@ -37,9 +37,11 @@ else:
urlparse = urllib.parse.urlparse 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 # 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' GOLDEN_SITE_VER = '7'
@ -108,12 +110,12 @@ class IsoEnvDir(DirHelpers, fixtures.Fixture):
class GerritHelpers(DirHelpers): class GerritHelpers(DirHelpers):
def init_dirs(self): def init_dirs(self):
self.primary_dir = os.path.abspath(os.path.curdir) self.primary_dir = os.path.abspath(os.path.curdir)
self.gerrit_dir = self._dir('primary', '.gerrit') self.gerrit_dir = self._dir('primary', '.gerrit')
self.gsite_dir = self._dir('gerrit', 'golden_site') 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): def ensure_gerrit_war(self):
# check if gerrit.war file exists in .gerrit directory # check if gerrit.war file exists in .gerrit directory
@ -121,8 +123,8 @@ class GerritHelpers(DirHelpers):
os.mkdir(self.gerrit_dir) os.mkdir(self.gerrit_dir)
if not os.path.exists(self.gerrit_war): if not os.path.exists(self.gerrit_war):
print("Downloading Gerrit binary from %s..." % WAR_URL) print("Downloading Gerrit binary from %s..." % self.war_url)
resp = requests.get(WAR_URL) resp = requests.get(self.war_url)
if resp.status_code != 200: if resp.status_code != 200:
raise RuntimeError("Problem requesting Gerrit war") raise RuntimeError("Problem requesting Gerrit war")
utils.write_to_file(self.gerrit_war, resp.content) utils.write_to_file(self.gerrit_war, resp.content)