summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon Westphahl <simon.westphahl@bmw.de>2022-03-08 15:32:53 +0100
committerSimon Westphahl <simon.westphahl@bmw.de>2022-03-08 16:23:18 +0100
commit2f69e30f90d30fc726547c2967bd61387a4b6ce9 (patch)
treeea6b6f3a989f0c2271f14e2b8038337cd1d56653 /tests
parent6f122dc18d9abb1a05de5dfecb6d3e0c3d647a7d (diff)
downloadzuul-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')
-rw-r--r--tests/fixtures/config/tenant-parser/extra.yaml3
-rw-r--r--tests/fixtures/config/tenant-parser/git/org_project6/.zuul.yaml0
-rw-r--r--tests/fixtures/config/tenant-parser/git/org_project6/other/extra.d/extra.yaml9
-rw-r--r--tests/fixtures/config/tenant-parser/git/org_project6/playbooks/common.yaml2
-rw-r--r--tests/unit/test_configloader.py25
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(
"""