diff options
author | James E. Blair <jim@acmegating.com> | 2022-09-07 10:29:54 -0700 |
---|---|---|
committer | James E. Blair <jim@acmegating.com> | 2022-09-07 10:29:54 -0700 |
commit | b1ce0c469c04917c94278230b1d2ea232b7c9320 (patch) | |
tree | c6e8cc05470fae3a59b27269fccf68713a979f8c /tests/unit/test_scheduler.py | |
parent | 0b4c6b011701f8723cb722a739d2ce24d6ad4376 (diff) | |
download | zuul-b1ce0c469c04917c94278230b1d2ea232b7c9320.tar.gz |
Fix race in test_periodic_freeze_job_failure
Timer unit test jobs should disable timer triggers before ending,
otherwise we may not shut down cleanly and will fail the test.
Change-Id: I2bbbfcaa7da50cd2daedb8f7dea11eb5725d56e4
Diffstat (limited to 'tests/unit/test_scheduler.py')
-rw-r--r-- | tests/unit/test_scheduler.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py index 978bc00a4..3445e9dc6 100644 --- a/tests/unit/test_scheduler.py +++ b/tests/unit/test_scheduler.py @@ -5372,6 +5372,17 @@ For CI problems and help debugging, contact ci@example.org""" 'database'].getBuildsets()) if buildsets: break + # Stop queuing timer triggered jobs so that the assertions + # below don't race against more jobs being queued. + self.commitConfigUpdate('org/common-config', 'layouts/no-timer.yaml') + self.scheds.execute(lambda app: app.sched.reconfigure(app.config)) + self.waitUntilSettled() + # If APScheduler is in mid-event when we remove the job, we + # can end up with one more event firing, so give it an extra + # second to settle. + time.sleep(3) + self.waitUntilSettled() + self.assertEqual(buildsets[0].result, 'CONFIG_ERROR') self.assertIn('Job project-test2 depends on project-test1 ' 'which was not run', buildsets[0].message) |