Fix tests which checks stack deletion

Change-Id: I78a00afa257c487cc8cd6923a6b16c42f3c18859
Closes-bug: #1346798
This commit is contained in:
Sergey Murashov 2014-07-22 13:48:45 +04:00
parent 17bd293076
commit c801531ea5

View File

@ -389,10 +389,11 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
self.client.deploy_session(environment_id, session_id) self.client.deploy_session(environment_id, session_id)
return self.client.wait_for_environment_deploy(environment_id) return self.client.wait_for_environment_deploy(environment_id)
def _get_stack(self, name): def _get_stack(self, environment_id):
by_name = {'name': name}
stack_iter = self.heat_client.stacks.list(limit=1, filters=by_name) for stack in self.heat_client.stacks.list():
return next(stack_iter, None) if environment_id in stack.description:
return stack
def test_instance_refs_are_removed_after_application_is_removed(self): def test_instance_refs_are_removed_after_application_is_removed(self):
name = 'e' + uuid.uuid4().hex name = 'e' + uuid.uuid4().hex
@ -413,7 +414,8 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
self.client.deploy_session(environment_id, session_id) self.client.deploy_session(environment_id, session_id)
self.client.wait_for_environment_deploy(environment_id) self.client.wait_for_environment_deploy(environment_id)
template = self.heat_client.stacks.template(name) stack_name = self._get_stack(environment_id).stack_name
template = self.heat_client.stacks.template(stack_name)
ip_addresses = '{0}-assigned-ip'.format(instance_name) ip_addresses = '{0}-assigned-ip'.format(instance_name)
floating_ip = '{0}-FloatingIPaddress'.format(instance_name) floating_ip = '{0}-FloatingIPaddress'.format(instance_name)
@ -428,7 +430,7 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
environment = self._quick_deploy(name, application) environment = self._quick_deploy(name, application)
self.assertIsNotNone(environment) self.assertIsNotNone(environment)
stack = self._get_stack(name) stack = self._get_stack(environment['id'])
self.assertIsNotNone(stack) self.assertIsNotNone(stack)
self.client.delete_environment(environment['id']) self.client.delete_environment(environment['id'])
@ -438,5 +440,5 @@ class MuranoBase(testtools.TestCase, testtools.testcase.WithAttributes,
if time.time() - start_time > 300: if time.time() - start_time > 300:
break break
time.sleep(5) time.sleep(5)
stack = self._get_stack(name) stack = self._get_stack(environment['id'])
self.assertIsNone(stack, 'stack is not deleted') self.assertIsNone(stack, 'stack is not deleted')