Fix race in CRD duplicates test
The CRD duplicates test was removing the job hold flag which meant all
FakeBuild threads were racing each other to update the FakeWorker
history. Avoid this by releasing jobs for one change at a time and
letting them settle before checking the job history list.
Change-Id: I86ee058546d2f0b833106725b419a8adcb1b7508
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index b44dba6..fe69fa9 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -3399,10 +3399,13 @@
self.waitUntilSettled()
self.assertEqual(len(check_pipeline.getAllItems()), 3)
- self.gearman_server.hold_jobs_in_queue = False
+ # Release jobs in order to avoid races with change A jobs
+ # finishing before change B jobs.
self.gearman_server.release('.*-merge')
+ self.gearman_server.release('project1-.*')
self.waitUntilSettled()
self.gearman_server.release('.*-merge')
+ self.gearman_server.release('project1-.*')
self.waitUntilSettled()
self.gearman_server.release()
self.waitUntilSettled()