summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-03-08 01:25:08 +0000
committerGerrit Code Review <review@openstack.org>2017-03-08 01:25:08 +0000
commit56f5d958472fe022a156d05e0c7250dd8785b880 (patch)
treeaac5c4b7d6726b2991a73631f996e0388b9a97d4
parenta9812278092eb77134f7a7b481d556efbcc2d281 (diff)
parent3aa6d47370db111c6335aab95f9ba9ee50c025fb (diff)
downloadzuul-56f5d958472fe022a156d05e0c7250dd8785b880.tar.gz
Merge "Re-enable test_tags" into feature/zuulv3
-rw-r--r--tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml2
-rw-r--r--tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml2
-rw-r--r--tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml2
-rw-r--r--tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml2
-rw-r--r--tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml52
-rw-r--r--tests/fixtures/layout-tags.yaml42
-rw-r--r--tests/fixtures/tags_custom_functions.py2
-rwxr-xr-xtests/unit/test_scheduler.py16
-rw-r--r--zuul/launcher/client.py4
9 files changed, 72 insertions, 52 deletions
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml
new file mode 100644
index 000000000..f679dceae
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/integration.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+ tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml
new file mode 100644
index 000000000..f679dceae
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/merge.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+ tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml
new file mode 100644
index 000000000..f679dceae
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test1.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+ tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml
new file mode 100644
index 000000000..f679dceae
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/playbooks/test2.yaml
@@ -0,0 +1,2 @@
+- hosts: all
+ tasks: []
diff --git a/tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml b/tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml
new file mode 100644
index 000000000..c921c909f
--- /dev/null
+++ b/tests/fixtures/config/single-tenant/git/layout-tags/zuul.yaml
@@ -0,0 +1,52 @@
+- pipeline:
+ name: check
+ manager: independent
+ source:
+ gerrit
+ trigger:
+ gerrit:
+ - event: patchset-created
+ success:
+ gerrit:
+ verified: 1
+ failure:
+ gerrit:
+ verified: -1
+
+- job:
+ name: merge
+ failure-message: Unable to merge change
+ hold-following-changes: true
+ tags:
+ - merge
+
+- job:
+ name: test1
+
+- job:
+ name: test2
+
+- job:
+ name: integration
+
+- project:
+ name: org/project1
+ check:
+ jobs:
+ - merge:
+ jobs:
+ - test1
+ - test2
+ - integration
+ tags:
+ - extratag
+
+- project:
+ name: org/project2
+ check:
+ jobs:
+ - merge:
+ jobs:
+ - test1
+ - test2
+ - integration
diff --git a/tests/fixtures/layout-tags.yaml b/tests/fixtures/layout-tags.yaml
deleted file mode 100644
index d5b8bf94f..000000000
--- a/tests/fixtures/layout-tags.yaml
+++ /dev/null
@@ -1,42 +0,0 @@
-includes:
- - python-file: tags_custom_functions.py
-
-pipelines:
- - name: check
- manager: IndependentPipelineManager
- trigger:
- gerrit:
- - event: patchset-created
- success:
- gerrit:
- verified: 1
- failure:
- gerrit:
- verified: -1
-
-jobs:
- - name: ^.*$
- parameter-function: apply_tags
- - name: ^.*-merge$
- failure-message: Unable to merge change
- hold-following-changes: true
- tags: merge
- - name: project1-merge
- tags:
- - project1
- - extratag
-
-projects:
- - name: org/project1
- check:
- - project1-merge:
- - project1-test1
- - project1-test2
- - project1-project2-integration
-
- - name: org/project2
- check:
- - project2-merge:
- - project2-test1
- - project2-test2
- - project1-project2-integration
diff --git a/tests/fixtures/tags_custom_functions.py b/tests/fixtures/tags_custom_functions.py
deleted file mode 100644
index 67e7ef144..000000000
--- a/tests/fixtures/tags_custom_functions.py
+++ /dev/null
@@ -1,2 +0,0 @@
-def apply_tags(item, job, params):
- params['BUILD_TAGS'] = ' '.join(sorted(job.tags))
diff --git a/tests/unit/test_scheduler.py b/tests/unit/test_scheduler.py
index 02e648eff..1e56faecb 100755
--- a/tests/unit/test_scheduler.py
+++ b/tests/unit/test_scheduler.py
@@ -2753,11 +2753,9 @@ class TestScheduler(ZuulTestCase):
self.assertEqual(B.data['status'], 'MERGED')
self.assertEqual(B.reported, 2)
- @skip("Disabled for early v3 development")
def test_tags(self):
"Test job tags"
- self.config.set('zuul', 'layout_config',
- 'tests/fixtures/layout-tags.yaml')
+ self.updateConfigLayout('layout-tags')
self.sched.reconfigure(self.config)
A = self.fake_gerrit.addFakeChange('org/project1', 'master', 'A')
@@ -2766,12 +2764,16 @@ class TestScheduler(ZuulTestCase):
self.fake_gerrit.addEvent(B.getPatchsetCreatedEvent(1))
self.waitUntilSettled()
- results = {'project1-merge': 'extratag merge project1',
- 'project2-merge': 'merge'}
+ self.assertEqual(len(self.history), 8)
+
+ results = {self.getJobFromHistory('merge',
+ project='org/project1').uuid: 'extratag merge',
+ self.getJobFromHistory('merge',
+ project='org/project2').uuid: 'merge'}
for build in self.history:
- self.assertEqual(results.get(build.name, ''),
- build.parameters.get('BUILD_TAGS'))
+ self.assertEqual(results.get(build.uuid, ''),
+ build.parameters['vars']['zuul'].get('tags'))
def test_timer(self):
"Test that a periodic job is triggered"
diff --git a/zuul/launcher/client.py b/zuul/launcher/client.py
index 63c9c86d6..52e439774 100644
--- a/zuul/launcher/client.py
+++ b/zuul/launcher/client.py
@@ -225,7 +225,9 @@ class LaunchClient(object):
zuul_params = dict(uuid=uuid,
pipeline=pipeline.name,
job=job.name,
- project=item.change.project.name)
+ project=item.change.project.name,
+ tags=' '.join(sorted(job.tags)))
+
if hasattr(item.change, 'branch'):
zuul_params['branch'] = item.change.branch
if hasattr(item.change, 'number'):