Add pipeline precedence
Allow, eg, jobs in a gate pipeline to take precedence over
a check pipeline.
Change-Id: Idf91527704cc75b00a336291f91b908286f8e630
Reviewed-on: https://review.openstack.org/36552
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index 023ed35..b67e09f 100644
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -495,7 +495,8 @@
self.worker.build_history.append(
BuildHistory(name=self.name, number=self.number,
result=result, changes=changes, node=self.node,
- uuid=self.unique, description=self.description)
+ uuid=self.unique, description=self.description,
+ pipeline=self.parameters['ZUUL_PIPELINE'])
)
self.job.sendWorkComplete(json.dumps(data))
@@ -2267,6 +2268,28 @@
self.assertTrue(re.search("project-test2.*SUCCESS", desc))
self.assertTrue(re.search("Reported result.*SUCCESS", desc))
+ def test_queue_precedence(self):
+ "Test that queue precedence works"
+
+ self.gearman_server.hold_jobs_in_queue = True
+ A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A')
+ self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
+ A.addApproval('CRVW', 2)
+ self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
+
+ self.waitUntilSettled()
+ self.gearman_server.hold_jobs_in_queue = False
+ self.gearman_server.release()
+ self.waitUntilSettled()
+
+ self.log.debug(self.history)
+ self.assertEqual(self.history[0].pipeline, 'gate')
+ self.assertEqual(self.history[1].pipeline, 'check')
+ self.assertEqual(self.history[2].pipeline, 'gate')
+ self.assertEqual(self.history[3].pipeline, 'gate')
+ self.assertEqual(self.history[4].pipeline, 'check')
+ self.assertEqual(self.history[5].pipeline, 'check')
+
def test_json_status(self):
"Test that we can retrieve JSON status info"
self.worker.hold_jobs_in_build = True