Browse Source

Merge "Fix updating change when emulating gerrit topic support"

changes/18/841418/1
Zuul 2 weeks ago committed by Gerrit Code Review
parent
commit
fd34e0bd1c
  1. 38
      tests/unit/test_circular_dependencies.py
  2. 3
      zuul/manager/__init__.py

38
tests/unit/test_circular_dependencies.py

@ -1677,6 +1677,44 @@ class TestGerritCircularDependencies(ZuulTestCase):
self.assertEqual(A.data["status"], "MERGED")
self.assertEqual(B.data["status"], "MERGED")
@simple_layout('layouts/deps-by-topic.yaml')
def test_deps_by_topic_new_patchset(self):
# Make sure that we correctly update the change cache on new
# patchsets.
A = self.fake_gerrit.addFakeChange('org/project1', "master", "A",
topic='test-topic')
B = self.fake_gerrit.addFakeChange('org/project2', "master", "B",
topic='test-topic')
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
self.assertEqual(len(A.patchsets[-1]["approvals"]), 1)
self.assertEqual(A.patchsets[-1]["approvals"][0]["type"], "Verified")
self.assertEqual(A.patchsets[-1]["approvals"][0]["value"], "1")
self.assertEqual(len(B.patchsets[-1]["approvals"]), 1)
self.assertEqual(B.patchsets[-1]["approvals"][0]["type"], "Verified")
self.assertEqual(B.patchsets[-1]["approvals"][0]["value"], "1")
self.assertHistory([
dict(name="test-job", result="SUCCESS", changes="2,1 1,1"),
dict(name="test-job", result="SUCCESS", changes="1,1 2,1"),
], ordered=False)
A.addPatchset()
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(2))
self.waitUntilSettled()
self.assertHistory([
# Original check run
dict(name="test-job", result="SUCCESS", changes="2,1 1,1"),
dict(name="test-job", result="SUCCESS", changes="1,1 2,1"),
# Second check run
dict(name="test-job", result="SUCCESS", changes="2,1 1,2"),
], ordered=False)
class TestGithubCircularDependencies(ZuulTestCase):
config_file = "zuul-gerrit-github.conf"

3
zuul/manager/__init__.py

@ -851,8 +851,7 @@ class PipelineManager(metaclass=ABCMeta):
new_topic_needs_changes.append(dep.cache_key)
update_attrs['topic_needs_changes'] = new_topic_needs_changes
if change.commit_needs_changes != new_commit_needs_changes:
source.setChangeAttributes(change, **update_attrs)
source.setChangeAttributes(change, **update_attrs)
def provisionNodes(self, item):
log = item.annotateLogger(self.log)

Loading…
Cancel
Save