Browse Source

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
tags/3.5.0
Simon Westphahl 6 months ago
parent
commit
53ec16de9d
2 changed files with 24 additions and 3 deletions
  1. 20
    0
      tests/unit/test_v3.py
  2. 4
    3
      zuul/model.py

+ 20
- 0
tests/unit/test_v3.py View File

@@ -3039,9 +3039,29 @@ class TestDataReturn(AnsibleZuulTestCase):
3039 3039
                       A.messages[-1])
3040 3040
 
3041 3041
     def test_data_return_child_jobs(self):
3042
+        self.wait_timeout = 120
3043
+        self.executor_server.hold_jobs_in_build = True
3044
+
3042 3045
         A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
3043 3046
         self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
3044 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 3065
         self.assertHistory([
3046 3066
             dict(name='data-return-child-jobs', result='SUCCESS',
3047 3067
                  changes='1,1'),

+ 4
- 3
zuul/model.py View File

@@ -2057,8 +2057,8 @@ class QueueItem(object):
2057 2057
         """Check if any jobs have finished with a non-success result.
2058 2058
 
2059 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
2061
-        and in-flight jobs are ignored.
2060
+        status not equal to SUCCESS or SKIPPED, else return False.
2061
+        Non-voting and in-flight jobs are ignored.
2062 2062
 
2063 2063
         """
2064 2064
         if not self.hasJobGraph():
@@ -2067,7 +2067,8 @@ class QueueItem(object):
2067 2067
             if not job.voting:
2068 2068
                 continue
2069 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 2072
                 return True
2072 2073
         return False
2073 2074
 

Loading…
Cancel
Save