Merge "Convergence: pass the input_data into Stack.load()"
This commit is contained in:
commit
bbebd38ba1
@ -255,8 +255,9 @@ class Resource(object):
|
|||||||
|
|
||||||
@contextlib.contextmanager
|
@contextlib.contextmanager
|
||||||
def special_stack(tmpl, swap_template):
|
def special_stack(tmpl, swap_template):
|
||||||
# TODO(sirushtim): Load stack from cache
|
stk = stack_mod.Stack.load(context, db_res.stack_id,
|
||||||
stk = stack_mod.Stack.load(context, db_res.stack_id)
|
cache_data=data)
|
||||||
|
|
||||||
# NOTE(sirushtim): Because on delete/cleanup operations, we simply
|
# NOTE(sirushtim): Because on delete/cleanup operations, we simply
|
||||||
# update with another template, the stack object won't have the
|
# update with another template, the stack object won't have the
|
||||||
# template of the previous stack-run.
|
# template of the previous stack-run.
|
||||||
|
@ -1877,6 +1877,34 @@ class ResourceTest(common.HeatTestCase):
|
|||||||
self.assertRaises(scheduler.Timeout, res.delete_convergence,
|
self.assertRaises(scheduler.Timeout, res.delete_convergence,
|
||||||
1, {}, 'engine-007', timeout)
|
1, {}, 'engine-007', timeout)
|
||||||
|
|
||||||
|
@mock.patch.object(parser.Stack, 'load')
|
||||||
|
@mock.patch.object(resource.Resource, '_load_data')
|
||||||
|
@mock.patch.object(template.Template, 'load')
|
||||||
|
def test_load_loads_stack_with_cached_data(self, mock_tmpl_load,
|
||||||
|
mock_load_data,
|
||||||
|
mock_stack_load):
|
||||||
|
tmpl = template.Template({
|
||||||
|
'heat_template_version': '2013-05-23',
|
||||||
|
'resources': {
|
||||||
|
'res': {
|
||||||
|
'type': 'GenericResourceType'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, env=self.env)
|
||||||
|
stack = parser.Stack(utils.dummy_context(), 'test_stack',
|
||||||
|
tmpl)
|
||||||
|
stack.store()
|
||||||
|
mock_tmpl_load.return_value = tmpl
|
||||||
|
res = stack['res']
|
||||||
|
res._store()
|
||||||
|
data = {'bar': {'atrr1': 'baz', 'attr2': 'baz2'}}
|
||||||
|
mock_stack_load.return_value = stack
|
||||||
|
resource.Resource.load(stack.context, res.id, True, data)
|
||||||
|
mock_stack_load.assert_called_once_with(stack.context,
|
||||||
|
stack.id,
|
||||||
|
cache_data=data)
|
||||||
|
self.assertTrue(mock_load_data.called)
|
||||||
|
|
||||||
|
|
||||||
class ResourceAdoptTest(common.HeatTestCase):
|
class ResourceAdoptTest(common.HeatTestCase):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user