Add playbook support to simple_layout in tests
All jobs need playbooks, so make sure that we create a stub playbook
for every job which appears in a simple layout.
Move the test_nonvoting_pipeline test to use simple_layout.
Change-Id: Id207fa3c1d01bfaef49f51c86589781b7892585c
diff --git a/tests/base.py b/tests/base.py
index 120920b..2ad1085 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -1348,7 +1348,6 @@
self.init_repo("org/node-project")
self.init_repo("org/conflict-project")
self.init_repo("org/noop-project")
- self.init_repo("org/experimental-project")
self.statsd = FakeStatsd()
# note, use 127.0.0.1 rather than localhost to avoid getting ipv6
@@ -1505,9 +1504,12 @@
else:
return False
+ files = {}
path = os.path.join(FIXTURE_DIR, path)
with open(path) as f:
- layout = yaml.safe_load(f.read())
+ data = f.read()
+ layout = yaml.safe_load(data)
+ files['zuul.yaml'] = data
untrusted_projects = []
for item in layout:
if 'project' in item:
@@ -1517,6 +1519,9 @@
self.addCommitToRepo(name, 'initial commit',
files={'README': ''},
branch='master', tag='init')
+ if 'job' in item:
+ jobname = item['job']['name']
+ files['playbooks/%s.yaml' % jobname] = ''
root = os.path.join(self.test_root, "config")
if not os.path.exists(root):
@@ -1533,8 +1538,6 @@
os.path.join(FIXTURE_DIR, f.name))
self.init_repo('common-config')
- with open(path) as f:
- files = {'zuul.yaml': f.read()}
self.addCommitToRepo('common-config', 'add content from fixture',
files, branch='master', tag='init')
@@ -2030,8 +2033,7 @@
- org/layered-project
- org/node-project
- org/conflict-project
- - org/noop-project
- - org/experimental-project\n""" % path)
+ - org/noop-project\n""" % path)
for repo in untrusted_projects:
f.write(" - %s\n" % repo)
diff --git a/tests/fixtures/config/single-tenant/git/common-config/playbooks/experimental-project-test.yaml b/tests/fixtures/config/single-tenant/git/common-config/playbooks/experimental-project-test.yaml
deleted file mode 100644
index f679dce..0000000
--- a/tests/fixtures/config/single-tenant/git/common-config/playbooks/experimental-project-test.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- hosts: all
- tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml b/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
index 141c78f..b227632 100644
--- a/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
+++ b/tests/fixtures/config/single-tenant/git/common-config/zuul.yaml
@@ -40,17 +40,6 @@
- event: ref-updated
ref: ^(?!refs/).*$
-- pipeline:
- name: experimental
- manager: independent
- trigger:
- gerrit:
- - event: patchset-created
- success:
- gerrit: {}
- failure:
- gerrit: {}
-
- job:
name: project-merge
hold-following-changes: true
@@ -83,9 +72,6 @@
queue-name: integration
- job:
- name: experimental-project-test
-
-- job:
name: nonvoting-project-merge
hold-following-changes: true
@@ -193,14 +179,6 @@
- project-post
- project:
- name: org/experimental-project
- experimental:
- jobs:
- - project-merge
- - experimental-project-test:
- dependencies: project-merge
-
-- project:
name: org/noop-project
check:
jobs:
diff --git a/tests/fixtures/config/single-tenant/git/layout-smtp/playbooks/experimental-project-test.yaml b/tests/fixtures/config/single-tenant/git/layout-smtp/playbooks/experimental-project-test.yaml
deleted file mode 100644
index f679dce..0000000
--- a/tests/fixtures/config/single-tenant/git/layout-smtp/playbooks/experimental-project-test.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- hosts: all
- tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-smtp/zuul.yaml b/tests/fixtures/config/single-tenant/git/layout-smtp/zuul.yaml
index 395f920..8f53d02 100644
--- a/tests/fixtures/config/single-tenant/git/layout-smtp/zuul.yaml
+++ b/tests/fixtures/config/single-tenant/git/layout-smtp/zuul.yaml
@@ -58,9 +58,6 @@
- job:
name: project-test2
-- job:
- name: experimental-project-test
-
- project:
name: org/project
check:
diff --git a/tests/fixtures/config/single-tenant/git/org_experimental-project/README b/tests/fixtures/config/single-tenant/git/org_experimental-project/README
deleted file mode 100644
index 9daeafb..0000000
--- a/tests/fixtures/config/single-tenant/git/org_experimental-project/README
+++ /dev/null
@@ -1 +0,0 @@
-test
diff --git a/tests/fixtures/config/single-tenant/main.yaml b/tests/fixtures/config/single-tenant/main.yaml
index 8c3e809..7434232 100644
--- a/tests/fixtures/config/single-tenant/main.yaml
+++ b/tests/fixtures/config/single-tenant/main.yaml
@@ -19,4 +19,3 @@
- org/node-project
- org/conflict-project
- org/noop-project
- - org/experimental-project
diff --git a/tests/fixtures/layouts/nonvoting-pipeline.yaml b/tests/fixtures/layouts/nonvoting-pipeline.yaml
new file mode 100644
index 0000000..be5d5af
--- /dev/null
+++ b/tests/fixtures/layouts/nonvoting-pipeline.yaml
@@ -0,0 +1,25 @@
+- pipeline:
+ name: experimental
+ manager: independent
+ trigger:
+ gerrit:
+ - event: patchset-created
+ success:
+ gerrit: {}
+ failure:
+ gerrit: {}
+
+- job:
+ name: project-merge
+ hold-following-changes: true
+
+- job:
+ name: experimental-project-test
+
+- project:
+ name: org/experimental-project
+ experimental:
+ jobs:
+ - project-merge
+ - experimental-project-test:
+ dependencies: project-merge
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 366354c..bc84989 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -3805,6 +3805,7 @@
running_items = client.get_running_jobs()
self.assertEqual(0, len(running_items))
+ @simple_layout('layouts/nonvoting-pipeline.yaml')
def test_nonvoting_pipeline(self):
"Test that a nonvoting pipeline (experimental) can still report"