Remove redundant checks of stack status
The main methods create/update/delete in HeatIntegrationTest class
already contains _wait_for_stack_status, so we can remove duplicate
checks in tests.
Also was added paramter enable_cleanup for stack_create method, which
allows to disable CleanUp method in tests, where we delete stack
manually.
Change-Id: I41b546d648656676ec9bc3b38940eac68f9a848d
diff --git a/functional/test_template_resource.py b/functional/test_template_resource.py
index 392bddd..356fc2a 100644
--- a/functional/test_template_resource.py
+++ b/functional/test_template_resource.py
@@ -102,17 +102,12 @@
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,
+ # disable cleanup so we can call _stack_delete() directly.
+ stack_identifier = self.stack_create(
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')
+ enable_cleanup=False)
nested_ident = self.assert_resource_is_a_stack(stack_identifier,
'secret1')
@@ -445,16 +440,11 @@
return yaml.load(yaml_templ)
def test_abandon(self):
- stack_name = self._stack_rand_name()
- self.client.stacks.create(
- stack_name=stack_name,
+ stack_identifier = self.stack_create(
template=self.main_template,
files={'the.yaml': self.nested_templ},
- disable_rollback=True,
+ enable_cleanup=False
)
- stack = self.client.stacks.get(stack_name)
- stack_identifier = '%s/%s' % (stack_name, stack.id)
- self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
info = self.stack_abandon(stack_id=stack_identifier)
self.assertEqual(self._yaml_to_json(self.main_template),
@@ -527,16 +517,10 @@
self.client = self.orchestration_client
def test_check(self):
- stack_name = self._stack_rand_name()
- self.client.stacks.create(
- stack_name=stack_name,
+ stack_identifier = self.stack_create(
template=self.main_template,
- files={'the.yaml': self.nested_templ},
- disable_rollback=True,
+ files={'the.yaml': self.nested_templ}
)
- stack = self.client.stacks.get(stack_name)
- stack_identifier = '%s/%s' % (stack_name, stack.id)
- self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE')
self.client.actions.check(stack_id=stack_identifier)
self._wait_for_stack_status(stack_identifier, 'CHECK_COMPLETE')