diff options
author | Simon Westphahl <simon.westphahl@bmw.de> | 2022-03-08 15:32:53 +0100 |
---|---|---|
committer | Simon Westphahl <simon.westphahl@bmw.de> | 2022-03-08 16:23:18 +0100 |
commit | 2f69e30f90d30fc726547c2967bd61387a4b6ce9 (patch) | |
tree | ea6b6f3a989f0c2271f14e2b8038337cd1d56653 /tests | |
parent | 6f122dc18d9abb1a05de5dfecb6d3e0c3d647a7d (diff) | |
download | zuul-2f69e30f90d30fc726547c2967bd61387a4b6ce9.tar.gz |
Support non-top-level dirs as extra config path
This change adds support for configuring non-top-level directories
(e.g. `foobar/zuul.d/`) as an extra config path which did not work so
far.
It's not clear if this was a bug or intended behavior that was just not
documented.
Change-Id: I1bc468130c9324a2e1b5d7f50b42fdc045eaa741
Diffstat (limited to 'tests')
5 files changed, 39 insertions, 0 deletions
diff --git a/tests/fixtures/config/tenant-parser/extra.yaml b/tests/fixtures/config/tenant-parser/extra.yaml index 3a5f6b004..efa3fbc9b 100644 --- a/tests/fixtures/config/tenant-parser/extra.yaml +++ b/tests/fixtures/config/tenant-parser/extra.yaml @@ -20,3 +20,6 @@ extra-config-paths: - extra.yaml - extra.d/ + - org/project6: + extra-config-paths: + - other/extra.d/ diff --git a/tests/fixtures/config/tenant-parser/git/org_project6/.zuul.yaml b/tests/fixtures/config/tenant-parser/git/org_project6/.zuul.yaml new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/fixtures/config/tenant-parser/git/org_project6/.zuul.yaml diff --git a/tests/fixtures/config/tenant-parser/git/org_project6/other/extra.d/extra.yaml b/tests/fixtures/config/tenant-parser/git/org_project6/other/extra.d/extra.yaml new file mode 100644 index 000000000..c6645f4b9 --- /dev/null +++ b/tests/fixtures/config/tenant-parser/git/org_project6/other/extra.d/extra.yaml @@ -0,0 +1,9 @@ +- job: + name: project6-extra-dir + run: playbooks/common.yaml + +- project: + check: + jobs: + - project6-extra-dir + diff --git a/tests/fixtures/config/tenant-parser/git/org_project6/playbooks/common.yaml b/tests/fixtures/config/tenant-parser/git/org_project6/playbooks/common.yaml new file mode 100644 index 000000000..f679dceae --- /dev/null +++ b/tests/fixtures/config/tenant-parser/git/org_project6/playbooks/common.yaml @@ -0,0 +1,2 @@ +- hosts: all + tasks: [] diff --git a/tests/unit/test_configloader.py b/tests/unit/test_configloader.py index 47bf0d69a..7b474bfe2 100644 --- a/tests/unit/test_configloader.py +++ b/tests/unit/test_configloader.py @@ -891,6 +891,7 @@ class TestTenantExtra(TenantParserTestCase): tenant = self.scheds.first.sched.abide.tenants.get('tenant-one') self.assertTrue('project2-extra-file' in tenant.layout.jobs) self.assertTrue('project2-extra-dir' in tenant.layout.jobs) + self.assertTrue('project6-extra-dir' in tenant.layout.jobs) def test_dynamic_extra(self): in_repo_conf = textwrap.dedent( @@ -914,6 +915,30 @@ class TestTenantExtra(TenantParserTestCase): dict(name='project2-extra-file2', result='SUCCESS', changes='1,1'), ], ordered=False) + def test_dynamic_extra_dir(self): + in_repo_conf = textwrap.dedent( + """ + - job: + name: project6-extra-dir2 + parent: common-config-job + - project: + check: + jobs: + - project6-extra-dir + - project6-extra-dir2 + """) + file_dict = { + 'other/extra.d/new/extra.yaml': in_repo_conf, + } + A = self.fake_gerrit.addFakeChange('org/project6', 'master', 'A', + files=file_dict) + self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1)) + self.waitUntilSettled() + self.assertHistory([ + dict(name='project6-extra-dir', result='SUCCESS', changes='1,1'), + dict(name='project6-extra-dir2', result='SUCCESS', changes='1,1'), + ], ordered=False) + def test_extra_reconfigure(self): in_repo_conf = textwrap.dedent( """ |