Test that custom functions are live-reloaded
Change-Id: Ie9cc0869729f3304b281e1700912f43d7e3ac70d
This commit is contained in:
parent
63bb0ef073
commit
e712d9fee2
2
tests/fixtures/custom_functions_live_reconfiguration_functions.py
vendored
Normal file
2
tests/fixtures/custom_functions_live_reconfiguration_functions.py
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
def select_debian_node(item, params):
|
||||
params['ZUUL_NODE'] = 'wheezy'
|
34
tests/fixtures/layout-live-reconfiguration-functions.yaml
vendored
Normal file
34
tests/fixtures/layout-live-reconfiguration-functions.yaml
vendored
Normal file
@ -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
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user