Fix test race with paused build

The waitUntilSettled test method can return early in the case of
a paused build if checks the builds between when the executor
pauses it and the scheduler is notified.  To avoid this, have
waitUntilSettled check whether the scheduler thinks the build is
paused rather than the executor.

Change-Id: I24d48955efe9f27f3d2bd876b27d39b55f79ca17
This commit is contained in:
James E. Blair 2020-02-07 08:45:52 -08:00
parent d4fab7ceb8
commit 54bfda5a07
1 changed files with 5 additions and 4 deletions

View File

@ -3925,11 +3925,12 @@ class ZuulTestCase(BaseTestCase):
worker_build = self.executor_server.job_builds.get(
server_job.unique.decode('utf8'))
if worker_build:
if worker_build.isWaiting() or worker_build.paused:
if build.paused:
continue
else:
self.log.debug("%s is running" % worker_build)
return False
if worker_build.isWaiting():
continue
self.log.debug("%s is running" % worker_build)
return False
else:
self.log.debug("%s is unassigned" % server_job)
return False