Merge "Add test covering PARAM_CLEAR_PARAMETERS for patch update"

This commit is contained in:
Jenkins 2015-07-28 00:17:40 +00:00 committed by Gerrit Code Review
commit 7b5012912b

View File

@ -865,6 +865,41 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase):
tmpl.env.params)
self.assertEqual(stack.identifier(), result)
def test_stack_update_existing_parameters_remove(self):
'''Use a template with existing parameters, then update with a
template containing additional paramters and a list of
parameters to be removed.
'''
stack_name = 'service_update_test_stack_existing_parameters'
update_params = {'encrypted_param_names': [],
'parameter_defaults': {},
'parameters': {'newparam': 123},
'resource_registry': {'resources': {}}}
api_args = {rpc_api.PARAM_TIMEOUT: 60,
rpc_api.PARAM_EXISTING: True,
rpc_api.PARAM_CLEAR_PARAMETERS: ['removeme']}
t = template_format.parse(tools.wp_template)
t['parameters']['removeme'] = {'type': 'string'}
stack = utils.parse_stack(t, stack_name=stack_name,
params={'KeyName': 'test',
'removeme': 'foo'})
stack.set_stack_user_project_id('1234')
self.assertEqual({'KeyName': 'test', 'removeme': 'foo'},
stack.t.env.params)
with mock.patch('heat.engine.stack.Stack') as mock_stack:
mock_stack.load.return_value = stack
mock_stack.validate.return_value = None
result = self.man.update_stack(self.ctx, stack.identifier(),
t,
update_params,
None, api_args)
tmpl = mock_stack.call_args[0][2]
self.assertEqual({'KeyName': 'test', 'newparam': 123},
tmpl.env.params)
self.assertEqual(stack.identifier(), result)
def test_stack_update_reuses_api_params(self):
stack_name = 'service_update_test_stack'
params = {'foo': 'bar'}