Simplify ref checkout in validate cmd
When the current code needs the repo checked out to a specific commit it calls clone_repo. The clone_repo call makes sure the repo has been cloned locally, performs a fetch to get all tags and prunes any references no longer on the remote, then finally checks out the requested ref. The validation logic starts with cloning all necessary repos and performing these actions, so after that point, we should be able to just checkout the ref that we need for the given check. This will greatly improve the execution time of the validate job for repos that have had a large number of releases. Change-Id: Ie444c8ef8e91832c38ee69307382ddb5fb8e1b08 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
@@ -593,7 +593,7 @@ class TestValidateReleaseSHAExists(base.BaseTestCase):
|
||||
validate.validate_release_sha_exists(deliv, self.ctx)
|
||||
self.ctx.show_summary()
|
||||
self.assertEqual(0, len(self.ctx.warnings))
|
||||
self.assertEqual(1, len(self.ctx.errors))
|
||||
self.assertEqual(0, len(self.ctx.errors))
|
||||
|
||||
def test_no_such_hash(self):
|
||||
deliv = deliverable.Deliverable(
|
||||
@@ -653,7 +653,7 @@ class TestValidateExistingTags(base.BaseTestCase):
|
||||
self.repo.tag('0.8.0')
|
||||
self.commit_2 = self.repo.add_file('testfile2.txt')
|
||||
|
||||
@mock.patch('openstack_releases.gitutils.safe_clone_repo')
|
||||
@mock.patch('openstack_releases.gitutils.checkout_ref')
|
||||
def test_valid(self, clone):
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
@@ -798,6 +798,7 @@ class TestValidateReleaseBranchMembership(base.BaseTestCase):
|
||||
self.assertEqual(1, len(self.ctx.errors))
|
||||
|
||||
def test_hash_from_master_used_after_default_branch_should_exist_but_does_not(self):
|
||||
gitutils.clone_repo(self.ctx.workdir, 'openstack/releases')
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series='austin',
|
||||
@@ -1479,6 +1480,7 @@ class TestPuppetUtils(base.BaseTestCase):
|
||||
llam.return_value = True
|
||||
get_version.return_value = '99.1.0'
|
||||
cbs.return_value = True
|
||||
gitutils.clone_repo(self.ctx.workdir, 'openstack/puppet-watcher')
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series='ocata',
|
||||
@@ -1506,6 +1508,7 @@ class TestPuppetUtils(base.BaseTestCase):
|
||||
llam.return_value = True
|
||||
get_version.return_value = '99.1.0'
|
||||
cbs.return_value = True
|
||||
gitutils.clone_repo(self.ctx.workdir, 'openstack/puppet-watcher')
|
||||
deliv = deliverable.Deliverable(
|
||||
team='team',
|
||||
series=defaults.RELEASE,
|
||||
|
||||
Reference in New Issue
Block a user