Merge "Don't report enqueue of non-live item"

This commit is contained in:
Zuul 2020-02-13 06:50:31 +00:00 committed by Gerrit Code Review
commit d48be299ab
3 changed files with 7 additions and 3 deletions

View File

@ -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),

View File

@ -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):

View File

@ -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,