Merge "Fix skipped job counted as failed"

This commit is contained in:
Zuul 2019-01-09 15:49:09 +00:00 committed by Gerrit Code Review
commit 9801e8a07c
2 changed files with 24 additions and 3 deletions

View File

@ -3039,9 +3039,29 @@ class TestDataReturn(AnsibleZuulTestCase):
A.messages[-1])
def test_data_return_child_jobs(self):
self.wait_timeout = 120
self.executor_server.hold_jobs_in_build = True
A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
self.executor_server.release('data-return-child-jobs')
self.waitUntilSettled()
self.executor_server.release('data-return-child-jobs')
self.waitUntilSettled()
# Make sure skipped jobs are not reported as failing
tenant = self.sched.abide.tenants.get("tenant-one")
status = tenant.layout.pipelines["check"].formatStatusJSON()
self.assertEqual(
status["change_queues"][0]["heads"][0][0]["failing_reasons"], [])
self.executor_server.hold_jobs_in_build = False
self.executor_server.release()
self.waitUntilSettled()
self.assertHistory([
dict(name='data-return-child-jobs', result='SUCCESS',
changes='1,1'),

View File

@ -2065,8 +2065,8 @@ class QueueItem(object):
"""Check if any jobs have finished with a non-success result.
Return True if any job in the job graph has returned with a
status not equal to SUCCESS, else return False. Non-voting
and in-flight jobs are ignored.
status not equal to SUCCESS or SKIPPED, else return False.
Non-voting and in-flight jobs are ignored.
"""
if not self.hasJobGraph():
@ -2075,7 +2075,8 @@ class QueueItem(object):
if not job.voting:
continue
build = self.current_build_set.getBuild(job.name)
if build and build.result and (build.result != 'SUCCESS'):
if (build and build.result and
build.result not in ['SUCCESS', 'SKIPPED']):
return True
return False