Fix test race in test_periodic_override

The test case test_periodic_override checks if project overrice in
timer triggered pipelines works. For this it enables the timer trigger
and then creates the branch stable/havana. After some time it checks
all in flight builds that they checked out the correct
revision. However the branch creation itself first creates a branch
and then a commit. If the timer kicks in between those two steps zuul
will use the same commit for both branches and the test fails.

Fix this by creating the branch before enabling the timer.

Change-Id: I21866978f4ffaaad4484b2dc93c6a6afa0745f9d
This commit is contained in:
Tobias Henkel 2019-03-23 10:10:53 +01:00
parent e8ebb9895e
commit cac0a6c9ef
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 5 additions and 4 deletions

View File

@ -272,15 +272,16 @@ class TestExecutorRepos(ZuulTestCase):
# This tests that we can override the branch in a timer
# trigger (mostly to ensure backwards compatability for jobs).
self.executor_server.hold_jobs_in_build = True
# Start timer trigger - also org/project
self.commitConfigUpdate('common-config',
'layouts/repo-checkout-timer-override.yaml')
self.sched.reconfigure(self.config)
p1 = 'review.example.com/org/project1'
projects = [p1]
self.create_branch('org/project1', 'stable/havana')
# Start timer trigger - also org/project
self.commitConfigUpdate('common-config',
'layouts/repo-checkout-timer-override.yaml')
self.sched.reconfigure(self.config)
# The pipeline triggers every second, so we should have seen
# several by now.
time.sleep(5)