Add test covering PARAM_CLEAR_PARAMETERS for patch update
There's no coverage of the path where we clear parameters during a patch update, so add a test proving it works. Change-Id: Ic7f16f36305c4a9b7e9c019a306d3d12c4aadfe2
This commit is contained in:
parent
50361dd4ac
commit
0f237f89fa
@ -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'}
|
||||
|
Loading…
Reference in New Issue
Block a user