Merge "Fix race in test_periodic_override" into feature/zuulv3
diff --git a/tests/fixtures/layouts/repo-checkout-no-timer-override.yaml b/tests/fixtures/layouts/repo-checkout-no-timer-override.yaml
new file mode 100644
index 0000000..de3bfe0
--- /dev/null
+++ b/tests/fixtures/layouts/repo-checkout-no-timer-override.yaml
@@ -0,0 +1,21 @@
+- pipeline:
+ name: periodic
+ manager: independent
+ # Trigger is required, set it to one that is a noop
+ # during tests that check the timer trigger.
+ trigger:
+ gerrit:
+ - event: ref-updated
+
+- job:
+ name: integration
+ branches: master
+ override-branch: stable/havana
+ required-projects:
+ - org/project1
+
+- project:
+ name: org/project1
+ periodic:
+ jobs:
+ - integration
diff --git a/tests/unit/test_executor.py b/tests/unit/test_executor.py
index 4700bd1..95cccee 100755
--- a/tests/unit/test_executor.py
+++ b/tests/unit/test_executor.py
@@ -274,8 +274,9 @@
# Stop queuing timer triggered jobs so that the assertions
# below don't race against more jobs being queued.
self.commitConfigUpdate('common-config',
- 'layouts/repo-checkout-no-timer.yaml')
+ 'layouts/repo-checkout-no-timer-override.yaml')
self.sched.reconfigure(self.config)
+ self.waitUntilSettled()
self.assertEquals(1, len(self.builds), "One build is running")
@@ -313,6 +314,7 @@
self.commitConfigUpdate('common-config',
'layouts/repo-checkout-no-timer.yaml')
self.sched.reconfigure(self.config)
+ self.waitUntilSettled()
self.assertEquals(2, len(self.builds), "Two builds are running")
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 5fecfbe..ca108a0 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -1837,6 +1837,7 @@
# Must be in same repo, so overwrite config with another one
self.commitConfigUpdate('common-config', 'layouts/no-timer.yaml')
self.sched.reconfigure(self.config)
+ self.waitUntilSettled()
self.assertEqual(len(self.builds), 1, "One timer job")