diff options
author | Zuul <zuul@review.opendev.org> | 2022-08-31 23:40:06 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2022-08-31 23:40:06 +0000 |
commit | ea27f7a12424be833e42d580d1ba78d15f37c85d (patch) | |
tree | 192d83a206186d4b5ed8172a6ec682cb4f3727eb /tests | |
parent | 20e89b83cc255750fc771191c477f5c53fa5ff25 (diff) | |
parent | 5ac9367b25f72f5240a4afb11fd1b242378207a8 (diff) | |
download | zuul-ea27f7a12424be833e42d580d1ba78d15f37c85d.tar.gz |
Merge "Add config-error reporter and report config errors to DB"
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fixtures/layouts/freeze-job-failure.yaml | 32 | ||||
-rw-r--r-- | tests/fixtures/layouts/timer-freeze-job-failure.yaml | 26 | ||||
-rw-r--r-- | tests/unit/test_scheduler.py | 32 |
3 files changed, 90 insertions, 0 deletions
diff --git a/tests/fixtures/layouts/freeze-job-failure.yaml b/tests/fixtures/layouts/freeze-job-failure.yaml new file mode 100644 index 000000000..ae3f48324 --- /dev/null +++ b/tests/fixtures/layouts/freeze-job-failure.yaml @@ -0,0 +1,32 @@ +- pipeline: + name: check + manager: independent + trigger: + gerrit: + - event: patchset-created + success: + gerrit: + Verified: 1 + failure: + gerrit: + Verified: -1 + +- job: + name: base + parent: null + run: playbooks/base.yaml + +- job: + name: project-test1 + run: playbooks/project-test1.yaml + +- job: + name: project-test2 + run: playbooks/project-test2.yaml + +- project: + name: org/project + check: + jobs: + - project-test2: + dependencies: project-test1 diff --git a/tests/fixtures/layouts/timer-freeze-job-failure.yaml b/tests/fixtures/layouts/timer-freeze-job-failure.yaml new file mode 100644 index 000000000..2e6d709bb --- /dev/null +++ b/tests/fixtures/layouts/timer-freeze-job-failure.yaml @@ -0,0 +1,26 @@ +- pipeline: + name: periodic + manager: independent + trigger: + timer: + - time: '* * * * * */1' + +- job: + name: base + parent: null + run: playbooks/base.yaml + +- job: + name: project-test1 + run: playbooks/project-test1.yaml + +- job: + name: project-test2 + run: playbooks/project-test2.yaml + +- project: + name: org/project + periodic: + jobs: + - project-test2: + dependencies: project-test1 diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py index 66c508fea..978bc00a4 100644 --- a/tests/unit/test_scheduler.py +++ b/tests/unit/test_scheduler.py @@ -5343,6 +5343,11 @@ For CI problems and help debugging, contact ci@example.org""" self.assertIn('Error merging gerrit/org/project', B.messages[0]) self.assertNotIn('logs.example.com', B.messages[0]) self.assertNotIn('SKIPPED', B.messages[0]) + buildsets = list( + self.scheds.first.connections.connections[ + 'database'].getBuildsets()) + self.assertEqual(buildsets[0].result, 'MERGE_CONFLICT') + self.assertIn('This change or one of', buildsets[0].message) def test_submit_failure(self): A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A') @@ -5357,6 +5362,33 @@ For CI problems and help debugging, contact ci@example.org""" 'database'].getBuildsets()) self.assertEqual(buildsets[0].result, 'MERGE_FAILURE') + @simple_layout('layouts/timer-freeze-job-failure.yaml') + def test_periodic_freeze_job_failure(self): + self.waitUntilSettled() + + for x in iterate_timeout(30, 'buildset complete'): + buildsets = list( + self.scheds.first.connections.connections[ + 'database'].getBuildsets()) + if buildsets: + break + self.assertEqual(buildsets[0].result, 'CONFIG_ERROR') + self.assertIn('Job project-test2 depends on project-test1 ' + 'which was not run', buildsets[0].message) + + @simple_layout('layouts/freeze-job-failure.yaml') + def test_freeze_job_failure(self): + A = self.fake_gerrit.addFakeChange('org/project', 'master', 'A') + self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1)) + self.waitUntilSettled() + + buildsets = list( + self.scheds.first.connections.connections[ + 'database'].getBuildsets()) + self.assertEqual(buildsets[0].result, 'CONFIG_ERROR') + self.assertIn('Job project-test2 depends on project-test1 ' + 'which was not run', buildsets[0].message) + @simple_layout('layouts/nonvoting-pipeline.yaml') def test_nonvoting_pipeline(self): "Test that a nonvoting pipeline (experimental) can still report" |