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
This commit is contained in:
Tobias Henkel 2019-03-04 22:27:22 +01:00
parent f72682f477
commit 878fcc9397
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 5 additions and 2 deletions

View File

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