diff --git a/tests/base.py b/tests/base.py index c3a4c26c8f..143ec43585 100644 --- a/tests/base.py +++ b/tests/base.py @@ -296,7 +296,7 @@ class FakeGerritChange(object): if reset: self.checks[checker] = {'state': 'NOT_STARTED', 'created': str(datetime.datetime.now())} - chk = self.checks[checker] + chk = self.checks.setdefault(checker, {}) chk['updated'] = str(datetime.datetime.now()) for (key, default) in [ ('state', None), diff --git a/tests/unit/test_gerrit.py b/tests/unit/test_gerrit.py index 775b7bbf7a..7c328b09d5 100644 --- a/tests/unit/test_gerrit.py +++ b/tests/unit/test_gerrit.py @@ -284,7 +284,9 @@ class TestChecksApi(ZuulTestCase): @simple_layout('layouts/gerrit-checks.yaml') def test_check_pipeline(self): + B = self.fake_gerrit.addFakeChange('org/project', 'master', 'B') A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A') + A.setDependsOn(B, 1) A.setCheck('zuul:check', reset=True) self.waitForPoll('gerrit') self.waitUntilSettled() @@ -308,9 +310,11 @@ class TestChecksApi(ZuulTestCase): self.assertEqual(A.checks_history[3]['zuul:check']['message'], 'Change passed all voting jobs') self.assertHistory([ - dict(name='test-job', result='SUCCESS', changes='1,1')]) + dict(name='test-job', result='SUCCESS', changes='1,1 2,1')]) self.assertEqual(A.reported, 0, "no messages should be reported") self.assertEqual(A.messages, [], "no messages should be reported") + # Make sure B was never updated + self.assertEqual(len(B.checks_history), 0) @simple_layout('layouts/gerrit-checks.yaml') def test_gate_pipeline(self): diff --git a/zuul/manager/__init__.py b/zuul/manager/__init__.py index f26867f7bc..81b92b7820 100644 --- a/zuul/manager/__init__.py +++ b/zuul/manager/__init__.py @@ -354,7 +354,7 @@ class PipelineManager(object): item.live = live self.reportStats(item) item.quiet = quiet - if not item.reported_enqueue: + if item.live and not item.reported_enqueue: self.reportEnqueue(item) item.reported_enqueue = True self.enqueueChangesBehind(change, event, quiet,