Re-enable test_job_from_templates_launched job
There is a slight different in the zuulv3 syntax, we appear to lose
the ability to define template variables. The zuul configuration has
been updated accordingly.
Change-Id: I060eab9df841ce7ebcc6ae367e2122c5e7c01f55
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
diff --git a/tests/fixtures/config/templated-project/git/common-config/zuul.yaml b/tests/fixtures/config/templated-project/git/common-config/zuul.yaml
new file mode 100644
index 0000000..ee0a3e4
--- /dev/null
+++ b/tests/fixtures/config/templated-project/git/common-config/zuul.yaml
@@ -0,0 +1,65 @@
+- pipeline:
+ name: check
+ manager: independent
+ source:
+ gerrit
+ trigger:
+ gerrit:
+ - event: patchset-created
+ success:
+ gerrit:
+ verified: 1
+ failure:
+ gerrit:
+ verified: -1
+
+- pipeline:
+ name: gate
+ manager: dependent
+ success-message: Build succeeded (gate).
+ source:
+ gerrit
+ trigger:
+ gerrit:
+ - event: comment-added
+ approval:
+ - approved: 1
+ success:
+ gerrit:
+ verified: 2
+ submit: true
+ failure:
+ gerrit:
+ verified: -2
+ start:
+ gerrit:
+ verified: 0
+ precedence: high
+
+- pipeline:
+ name: post
+ manager: independent
+ source:
+ gerrit
+ trigger:
+ gerrit:
+ - event: ref-updated
+ ref: ^(?!refs/).*$
+
+- project-template:
+ name: test-one-and-two
+ check:
+ jobs:
+ - project-test1
+ - project-test2
+
+- job:
+ name: project-test1
+
+- job:
+ name: project-test2
+
+- project:
+ name: org/templated-project
+ templates:
+ - test-one-and-two
diff --git a/tests/fixtures/config/templated-project/git/org_templated-project/README b/tests/fixtures/config/templated-project/git/org_templated-project/README
new file mode 100644
index 0000000..9daeafb
--- /dev/null
+++ b/tests/fixtures/config/templated-project/git/org_templated-project/README
@@ -0,0 +1 @@
+test
diff --git a/tests/fixtures/config/templated-project/main.yaml b/tests/fixtures/config/templated-project/main.yaml
new file mode 100644
index 0000000..a22ed5c
--- /dev/null
+++ b/tests/fixtures/config/templated-project/main.yaml
@@ -0,0 +1,6 @@
+- tenant:
+ name: tenant-one
+ source:
+ gerrit:
+ config-repos:
+ - common-config
diff --git a/tests/fixtures/layout.yaml b/tests/fixtures/layout.yaml
index 418f4dd..dfe8ded 100644
--- a/tests/fixtures/layout.yaml
+++ b/tests/fixtures/layout.yaml
@@ -229,11 +229,6 @@
post:
- nonvoting-project-post
- - name: org/templated-project
- template:
- - name: test-one-and-two
- projectname: project
-
- name: org/layered-project
template:
- name: test-one-and-two
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index c9005f0..f91401c 100755
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -1227,20 +1227,6 @@
self.assertNotEqual(commit_A, commit_B, commit_C)
@skip("Disabled for early v3 development")
- def test_job_from_templates_launched(self):
- "Test whether a job generated via a template can be launched"
-
- A = self.fake_gerrit.addFakeChange(
- 'org/templated-project', 'master', 'A')
- self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
- self.waitUntilSettled()
-
- self.assertEqual(self.getJobFromHistory('project-test1').result,
- 'SUCCESS')
- self.assertEqual(self.getJobFromHistory('project-test2').result,
- 'SUCCESS')
-
- @skip("Disabled for early v3 development")
def test_layered_templates(self):
"Test whether a job generated via a template can be launched"
@@ -4679,3 +4665,20 @@
self.assertEqual(A.reported, 2)
self.assertEqual(B.data['status'], 'MERGED')
self.assertEqual(B.reported, 2)
+
+
+class TestSchedulerTemplatedProject(ZuulTestCase):
+ tenant_config_file = 'config/templated-project/main.yaml'
+
+ def test_job_from_templates_launched(self):
+ "Test whether a job generated via a template can be launched"
+
+ A = self.fake_gerrit.addFakeChange(
+ 'org/templated-project', 'master', 'A')
+ self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
+ self.waitUntilSettled()
+
+ self.assertEqual(self.getJobFromHistory('project-test1').result,
+ 'SUCCESS')
+ self.assertEqual(self.getJobFromHistory('project-test2').result,
+ 'SUCCESS')