From c99d3a4f2b09f3a7622c9bdebd71fab5dd166358 Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 13 Jul 2016 15:33:59 -0700 Subject: [PATCH] Install bc libs when running testsuite Newer openssh clients refuse to connect to Gerrit when it doesn't have bouncy castle libs installed bceause the available encryption methods are not secure. Fix this by installing the bc libs making ssh clients happy. Note that this changes the war to one with working bouncy castle package urls, it also reindexes after init to make this new war happy. Change-Id: I1c5db09c53a56ffd856da24decf29566e86f9d87 --- git_review/tests/__init__.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/git_review/tests/__init__.py b/git_review/tests/__init__.py index 3245e4e0..828ada18 100644 --- a/git_review/tests/__init__.py +++ b/git_review/tests/__init__.py @@ -34,10 +34,11 @@ from testtools import content from git_review.tests import utils -WAR_URL = 'https://gerrit-releases.storage.googleapis.com/gerrit-2.11.4.war' +WAR_URL = 'http://tarballs.openstack.org/' \ + 'ci/gerrit/gerrit-v2.11.4.13.cb9800e.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 = '3' +GOLDEN_SITE_VER = '4' class GerritHelpers(object): @@ -83,6 +84,16 @@ class GerritHelpers(object): GOLDEN_SITE_VER) return + # We write out the ssh host key for gerrit's ssh server which + # for undocumented reasons forces gerrit init to download the + # bouncy castle libs which we need for ssh that works on + # newer distros like ubuntu xenial. + os.makedirs(self._dir('gsite', 'etc')) + # create SSH host key + host_key_file = self._dir('gsite', 'etc', 'ssh_host_rsa_key') + utils.run_cmd('ssh-keygen', '-t', 'rsa', '-b', '4096', + '-f', host_key_file, '-N', '') + print("Creating a new golden site of version " + GOLDEN_SITE_VER) # initialize Gerrit @@ -90,6 +101,8 @@ class GerritHelpers(object): 'init', '-d', self.gsite_dir, '--batch', '--no-auto-start', '--install-plugin', 'download-commands') + utils.run_cmd('java', '-jar', self.gerrit_war, 'reindex', + '-d', self.gsite_dir) with open(golden_ver_file, 'w') as f: f.write(GOLDEN_SITE_VER)