summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-08-17 03:59:15 +0000
committerGerrit Code Review <review@openstack.org>2013-08-17 03:59:15 +0000
commitb11fa9763299b3d1eb3238c392163cccf99e71a0 (patch)
tree5bb78c7ef3d275cbff9bb02a42d54612a9ee5f6c
parent6241de0eb645e896d6a3b98894c41ce2381b396a (diff)
parente712d9fee2a04cdf9945fcbf6692911a36a77272 (diff)
downloadzuul-b11fa9763299b3d1eb3238c392163cccf99e71a0.tar.gz
Merge "Test that custom functions are live-reloaded"
-rw-r--r--tests/fixtures/custom_functions_live_reconfiguration_functions.py2
-rw-r--r--tests/fixtures/layout-live-reconfiguration-functions.yaml34
-rw-r--r--tests/test_scheduler.py30
3 files changed, 66 insertions, 0 deletions
diff --git a/tests/fixtures/custom_functions_live_reconfiguration_functions.py b/tests/fixtures/custom_functions_live_reconfiguration_functions.py
new file mode 100644
index 000000000..d8e06f430
--- /dev/null
+++ b/tests/fixtures/custom_functions_live_reconfiguration_functions.py
@@ -0,0 +1,2 @@
+def select_debian_node(item, params):
+ params['ZUUL_NODE'] = 'wheezy'
diff --git a/tests/fixtures/layout-live-reconfiguration-functions.yaml b/tests/fixtures/layout-live-reconfiguration-functions.yaml
new file mode 100644
index 000000000..f477a1250
--- /dev/null
+++ b/tests/fixtures/layout-live-reconfiguration-functions.yaml
@@ -0,0 +1,34 @@
+includes:
+ - python-file: custom_functions_live_reconfiguration_functions.py
+
+pipelines:
+ - name: gate
+ manager: DependentPipelineManager
+ failure-message: Build failed. For information on how to proceed, see http://wiki.example.org/Test_Failures
+ trigger:
+ gerrit:
+ - event: comment-added
+ approval:
+ - approved: 1
+ success:
+ verified: 2
+ submit: true
+ failure:
+ verified: -2
+ start:
+ verified: 0
+ precedence: high
+
+jobs:
+ - name: ^.*-merge$
+ failure-message: Unable to merge change
+ hold-following-changes: true
+ - name: node-project-test1
+ parameter-function: select_debian_node
+
+projects:
+ - name: org/node-project
+ gate:
+ - node-project-merge:
+ - node-project-test1
+ - node-project-test2
diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py
index faace9d3c..48baaeff9 100644
--- a/tests/test_scheduler.py
+++ b/tests/test_scheduler.py
@@ -2467,6 +2467,36 @@ class TestScheduler(testtools.TestCase):
self.assertEqual(A.data['status'], 'MERGED')
self.assertEqual(A.reported, 2)
+ def test_live_reconfiguration_functions(self):
+ "Test live reconfiguration with a custom function"
+ self.worker.registerFunction('build:node-project-test1:debian')
+ self.worker.registerFunction('build:node-project-test1:wheezy')
+ A = self.fake_gerrit.addFakeChange('org/node-project', 'master', 'A')
+ A.addApproval('CRVW', 2)
+ self.fake_gerrit.addEvent(A.addApproval('APRV', 1))
+ self.waitUntilSettled()
+
+ self.assertIsNone(self.getJobFromHistory('node-project-merge').node)
+ self.assertEqual(self.getJobFromHistory('node-project-test1').node,
+ 'debian')
+ self.assertIsNone(self.getJobFromHistory('node-project-test2').node)
+
+ self.config.set('zuul', 'layout_config',
+ 'tests/fixtures/layout-live-'
+ 'reconfiguration-functions.yaml')
+ self.sched.reconfigure(self.config)
+ self.worker.build_history = []
+
+ B = self.fake_gerrit.addFakeChange('org/node-project', 'master', 'B')
+ B.addApproval('CRVW', 2)
+ self.fake_gerrit.addEvent(B.addApproval('APRV', 1))
+ self.waitUntilSettled()
+
+ self.assertIsNone(self.getJobFromHistory('node-project-merge').node)
+ self.assertEqual(self.getJobFromHistory('node-project-test1').node,
+ 'wheezy')
+ self.assertIsNone(self.getJobFromHistory('node-project-test2').node)
+
def test_delayed_repo_init(self):
self.config.set('zuul', 'layout_config',
'tests/fixtures/layout-delayed-repo-init.yaml')