Browse Source

Fix test race in test_client_dequeue_change_by_ref

This is a try to fix a test race in test_client_dequeue_change_by_ref
because of a hard coded sleep. Instead if the sleep wait for the two
builds of master and stable to appear.

Change-Id: I326b85c006edbe1f6a194d8abd7632b6035e82b2
tags/3.6.0
Tobias Henkel 2 months ago
parent
commit
878fcc9397
No account linked to committer's email address
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      tests/unit/test_scheduler.py

+ 5
- 2
tests/unit/test_scheduler.py View File

@@ -3965,9 +3965,12 @@ class TestScheduler(ZuulTestCase):
3965 3965
         self.executor_server.hold_jobs_in_build = True
3966 3966
         self.commitConfigUpdate('common-config', 'layouts/timer.yaml')
3967 3967
         self.sched.reconfigure(self.config)
3968
-        self.waitUntilSettled()
3969 3968
 
3970
-        time.sleep(5)
3969
+        # We expect that one build for each branch (master and stable) appears.
3970
+        for _ in iterate_timeout(30, 'Wait for two builds that are hold'):
3971
+            if len(self.builds) == 2:
3972
+                break
3973
+        self.waitUntilSettled()
3971 3974
 
3972 3975
         client.dequeue(
3973 3976
             tenant='tenant-one',

Loading…
Cancel
Save