Move nested stack delete test to functional
This tries to prove that if you manually delete a nested stack, the parent stack is still deletable. part of blueprint decouple-nested Change-Id: I1d0bf7b5d982dc1f312fbe70cbb09a2e624e3371
This commit is contained in:
parent
5e25330ff1
commit
3c9bdbeae6
@ -242,25 +242,6 @@ Resources:
|
||||
self.assertIn('Recursion depth exceeds', stack.status_reason)
|
||||
self.m.VerifyAll()
|
||||
|
||||
def test_nested_stack_delete_then_delete_parent_stack(self):
|
||||
urlfetch.get('https://server.test/the.template'
|
||||
).MultipleTimes().AndReturn(self.nested_template)
|
||||
self.m.ReplayAll()
|
||||
|
||||
stack = self.create_stack(self.test_template)
|
||||
rsrc = stack['the_nested']
|
||||
|
||||
nested_stack = parser.Stack.load(utils.dummy_context(
|
||||
'test_username', 'aaaa', 'password'), rsrc.resource_id)
|
||||
nested_stack.delete()
|
||||
|
||||
stack = parser.Stack.load(utils.dummy_context(
|
||||
'test_username', 'aaaa', 'password'), stack.id)
|
||||
stack.delete()
|
||||
self.assertEqual((stack.DELETE, stack.COMPLETE), stack.state)
|
||||
|
||||
self.m.VerifyAll()
|
||||
|
||||
def test_child_params(self):
|
||||
t = template_format.parse(self.test_template)
|
||||
stack = self.parse_stack(t)
|
||||
|
@ -23,6 +23,31 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class TemplateResourceTest(test.HeatIntegrationTest):
|
||||
"""Prove that we can use the registry in a nested provider."""
|
||||
|
||||
template = '''
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
secret1:
|
||||
type: OS::Heat::RandomString
|
||||
outputs:
|
||||
secret-out:
|
||||
value: { get_attr: [secret1, value] }
|
||||
'''
|
||||
nested_templ = '''
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
secret2:
|
||||
type: OS::Heat::RandomString
|
||||
outputs:
|
||||
value:
|
||||
value: { get_attr: [secret2, value] }
|
||||
'''
|
||||
|
||||
env_templ = '''
|
||||
resource_registry:
|
||||
"OS::Heat::RandomString": nested.yaml
|
||||
'''
|
||||
|
||||
def setUp(self):
|
||||
super(TemplateResourceTest, self).setUp()
|
||||
self.client = self.orchestration_client
|
||||
@ -65,38 +90,36 @@ resource_registry:
|
||||
|
||||
And use that resource within the template resource.
|
||||
"""
|
||||
|
||||
main_templ = '''
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
secret1:
|
||||
type: OS::Heat::RandomString
|
||||
outputs:
|
||||
secret-out:
|
||||
value: { get_attr: [secret1, value] }
|
||||
'''
|
||||
|
||||
nested_templ = '''
|
||||
heat_template_version: 2013-05-23
|
||||
resources:
|
||||
secret2:
|
||||
type: OS::Heat::RandomString
|
||||
outputs:
|
||||
value:
|
||||
value: { get_attr: [secret2, value] }
|
||||
'''
|
||||
|
||||
env_templ = '''
|
||||
resource_registry:
|
||||
"OS::Heat::RandomString": nested.yaml
|
||||
'''
|
||||
|
||||
stack_identifier = self.stack_create(
|
||||
template=main_templ,
|
||||
files={'nested.yaml': nested_templ},
|
||||
environment=env_templ)
|
||||
template=self.template,
|
||||
files={'nested.yaml': self.nested_templ},
|
||||
environment=self.env_templ)
|
||||
self.assert_resource_is_a_stack(stack_identifier, 'secret1')
|
||||
|
||||
def test_nested_stack_delete_then_delete_parent_stack(self):
|
||||
"""Check the robustness of stack deletion.
|
||||
|
||||
This tests that if you manually delete a nested
|
||||
stack, the parent stack is still deletable.
|
||||
"""
|
||||
name = self._stack_rand_name()
|
||||
# do this manually so we can call _stack_delete() directly.
|
||||
self.client.stacks.create(
|
||||
stack_name=name,
|
||||
template=self.template,
|
||||
files={'nested.yaml': self.nested_templ},
|
||||
environment=self.env_templ,
|
||||
disable_rollback=True)
|
||||
stack = self.client.stacks.get(name)
|
||||
stack_identifier = '%s/%s' % (name, stack.id)
|
||||
self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
|
||||
|
||||
nested_ident = self.assert_resource_is_a_stack(stack_identifier,
|
||||
'secret1')
|
||||
|
||||
self._stack_delete(nested_ident)
|
||||
self._stack_delete(stack_identifier)
|
||||
|
||||
|
||||
class NestedAttributesTest(test.HeatIntegrationTest):
|
||||
"""Prove that we can use the template resource references."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user