summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2018-12-18 14:26:55 +0100
committerSimon Westphahl <simon.westphahl@bmw.de>2019-01-02 10:31:16 +0100
commit53ec16de9dbb128704c9f1dda5fc3027d5baba9e (patch)
treeaea1c0d8ea272e750708cc6a0254c2e18c190c38
parent5f5032cf820359fb423e417eb12f7c542228b2b0 (diff)
Fix skipped job counted as failed
Skipped jobs were counted as failed, leading to an error status for the buildset in the web UI. Change-Id: I0634e7e1181d619a3cba40c4634c2ac28d70fdc6
Notes
Notes (review): Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Code-Review+2: Monty Taylor <mordred@inaugust.com> Code-Review+2: James E. Blair <corvus@inaugust.com> Workflow+1: James E. Blair <corvus@inaugust.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 09 Jan 2019 15:49:09 +0000 Reviewed-on: https://review.openstack.org/625910 Project: openstack-infra/zuul Branch: refs/heads/master
-rw-r--r--tests/unit/test_v3.py20
-rw-r--r--zuul/model.py7
2 files changed, 24 insertions, 3 deletions
diff --git a/tests/unit/test_v3.py b/tests/unit/test_v3.py
index e0553d3..0ded9c1 100644
--- a/tests/unit/test_v3.py
+++ b/tests/unit/test_v3.py
@@ -3039,9 +3039,29 @@ class TestDataReturn(AnsibleZuulTestCase):
3039 A.messages[-1]) 3039 A.messages[-1])
3040 3040
3041 def test_data_return_child_jobs(self): 3041 def test_data_return_child_jobs(self):
3042 self.wait_timeout = 120
3043 self.executor_server.hold_jobs_in_build = True
3044
3042 A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A') 3045 A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
3043 self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1)) 3046 self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
3044 self.waitUntilSettled() 3047 self.waitUntilSettled()
3048
3049 self.executor_server.release('data-return-child-jobs')
3050 self.waitUntilSettled()
3051
3052 self.executor_server.release('data-return-child-jobs')
3053 self.waitUntilSettled()
3054
3055 # Make sure skipped jobs are not reported as failing
3056 tenant = self.sched.abide.tenants.get("tenant-one")
3057 status = tenant.layout.pipelines["check"].formatStatusJSON()
3058 self.assertEqual(
3059 status["change_queues"][0]["heads"][0][0]["failing_reasons"], [])
3060
3061 self.executor_server.hold_jobs_in_build = False
3062 self.executor_server.release()
3063 self.waitUntilSettled()
3064
3045 self.assertHistory([ 3065 self.assertHistory([
3046 dict(name='data-return-child-jobs', result='SUCCESS', 3066 dict(name='data-return-child-jobs', result='SUCCESS',
3047 changes='1,1'), 3067 changes='1,1'),
diff --git a/zuul/model.py b/zuul/model.py
index 70f392c..ff8580b 100644
--- a/zuul/model.py
+++ b/zuul/model.py
@@ -2057,8 +2057,8 @@ class QueueItem(object):
2057 """Check if any jobs have finished with a non-success result. 2057 """Check if any jobs have finished with a non-success result.
2058 2058
2059 Return True if any job in the job graph has returned with a 2059 Return True if any job in the job graph has returned with a
2060 status not equal to SUCCESS, else return False. Non-voting 2060 status not equal to SUCCESS or SKIPPED, else return False.
2061 and in-flight jobs are ignored. 2061 Non-voting and in-flight jobs are ignored.
2062 2062
2063 """ 2063 """
2064 if not self.hasJobGraph(): 2064 if not self.hasJobGraph():
@@ -2067,7 +2067,8 @@ class QueueItem(object):
2067 if not job.voting: 2067 if not job.voting:
2068 continue 2068 continue
2069 build = self.current_build_set.getBuild(job.name) 2069 build = self.current_build_set.getBuild(job.name)
2070 if build and build.result and (build.result != 'SUCCESS'): 2070 if (build and build.result and
2071 build.result not in ['SUCCESS', 'SKIPPED']):
2071 return True 2072 return True
2072 return False 2073 return False
2073 2074