Reload tenant configuration on change merged
Whenever a change that updates the zuul config merges, Zuul should
immediately update its configuration. This should be generally
a no-op for changes to project repos in a dependent pipeline,
however, it may affect indepedent pipelines of project repos or
anything related to config repos (for which the config is not
updated dynamically).
To do this efficiently, try to use as much cached data as possible,
but still perform the re-enqueue operations which are normal for
a reconfiguration to ensure correctness. Limit the reconfiguration
to just the affected tenant. NOTE: this may be an error -- tenants
may share common config repos, and therefore, if a change lands to
such a repo, more than one tenant may need to be updated.
Change-Id: Ib35b0b663423b1a27f9e3bcdec7480345e3bdff1
diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py
index 74d69c9..dd812a8 100644
--- a/tests/unit/test_v3.py
+++ b/tests/unit/test_v3.py
@@ -107,13 +107,25 @@
A.addApproval('code-review', 2)
self.fake_gerrit.addEvent(A.addApproval('approved', 1))
self.waitUntilSettled()
- self.assertEqual(self.getJobFromHistory('project-test2').result,
- 'SUCCESS')
self.assertEqual(A.data['status'], 'MERGED')
self.assertEqual(A.reported, 2,
"A should report start and success")
self.assertIn('tenant-one-gate', A.messages[1],
"A should transit tenant-one gate")
+ self.assertHistory([
+ dict(name='project-test2', result='SUCCESS', changes='1,1')])
+
+ # Now that the config change is landed, it should be live for
+ # subsequent changes.
+ B = self.fake_gerrit.addFakeChange('org/project', 'master', 'B')
+ B.addApproval('code-review', 2)
+ self.fake_gerrit.addEvent(B.addApproval('approved', 1))
+ self.waitUntilSettled()
+ self.assertEqual(self.getJobFromHistory('project-test2').result,
+ 'SUCCESS')
+ self.assertHistory([
+ dict(name='project-test2', result='SUCCESS', changes='1,1'),
+ dict(name='project-test2', result='SUCCESS', changes='2,1')])
class TestAnsible(AnsibleZuulTestCase):