Browse Source

Merge "Fix skipped job counted as failed"

tags/3.5.0
Zuul 5 months ago
parent
commit
9801e8a07c
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

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

Loading…
Cancel
Save