Merge "Fix race in test_queue_rate_limiting_dependent" into feature/zuulv3
diff --git a/tests/base.py b/tests/base.py
index 2e4e9a5..9709bf7 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -2342,6 +2342,11 @@
if count is not None and i >= count:
break
+ def getSortedBuilds(self):
+ "Return the list of currently running builds sorted by name"
+
+ return sorted(self.builds, key=lambda x: x.name)
+
def release(self, job):
if isinstance(job, FakeBuild):
job.release()
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 1d24585..aa061ff 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -3367,8 +3367,9 @@
# Only C's test jobs are queued because window is still 1.
self.assertEqual(len(self.builds), 2)
- self.assertEqual(self.builds[0].name, 'project-test1')
- self.assertEqual(self.builds[1].name, 'project-test2')
+ builds = self.getSortedBuilds()
+ self.assertEqual(builds[0].name, 'project-test1')
+ self.assertEqual(builds[1].name, 'project-test2')
self.executor_server.release('project-.*')
self.waitUntilSettled()