tests remove stack_delete_after decorator

This is no longer required because cleanup is provided via reset
of the dummy db in all tests which call the base-class setUp.

Change-Id: I49cbfce0b2880d0318114df35d4abaed61d03bfc
This commit is contained in:
Steven Hardy 2014-04-25 17:02:53 +01:00
parent f666c2d3d3
commit d75324646c
18 changed files with 0 additions and 224 deletions

View File

@ -82,7 +82,6 @@ class MarconiMessageQueueTest(HeatTestCase):
self.stack.validate()
self.stack.store()
@utils.stack_delete_after
def test_create(self):
t = template_format.parse(wp_template)
self.parse_stack(t)
@ -113,7 +112,6 @@ class MarconiMessageQueueTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_existing_queue(self):
t = template_format.parse(wp_template)
self.parse_stack(t)
@ -135,7 +133,6 @@ class MarconiMessageQueueTest(HeatTestCase):
str(err))
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_failed(self):
t = template_format.parse(wp_template)
self.parse_stack(t)
@ -161,7 +158,6 @@ class MarconiMessageQueueTest(HeatTestCase):
str(err))
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete(self):
t = template_format.parse(wp_template)
self.parse_stack(t)
@ -184,7 +180,6 @@ class MarconiMessageQueueTest(HeatTestCase):
scheduler.TaskRunner(queue.delete)()
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_in_place(self):
t = template_format.parse(wp_template)
self.parse_stack(t)
@ -212,7 +207,6 @@ class MarconiMessageQueueTest(HeatTestCase):
scheduler.TaskRunner(queue.update, new_queue)()
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_replace(self):
t = template_format.parse(wp_template)
self.parse_stack(t)

View File

@ -106,7 +106,6 @@ class CloudNetworkTest(HeatTestCase):
res = self.stack['cnw']
self.assertEqual((res.CREATE, res.COMPLETE), res.state)
@utils.stack_delete_after
def test_attributes(self, mock_client):
self._setup_stack(mock_client)
res = self.stack['cnw']
@ -116,7 +115,6 @@ class CloudNetworkTest(HeatTestCase):
self.assertEqual(expect_label, res.FnGetAtt('label'))
self.assertEqual(expect_cidr, res.FnGetAtt('cidr'))
@utils.stack_delete_after
def test_create_bad_cider(self, mock_client):
self._template['resources']['cnw']['properties']['cidr'] = "bad cidr"
self._parse_stack()
@ -124,7 +122,6 @@ class CloudNetworkTest(HeatTestCase):
self.stack.validate)
self.assertIn("Invalid cidr", str(exc))
@utils.stack_delete_after
def test_delete(self, mock_client):
self._setup_stack(mock_client)
res = self.stack['cnw']
@ -134,13 +131,11 @@ class CloudNetworkTest(HeatTestCase):
exc = self.assertRaises(NotFound, self.fake_cnw.get, res_id)
self.assertIn(res_id, str(exc))
@utils.stack_delete_after
def test_delete_not_complete(self, mock_client):
self._setup_stack(mock_client)
res = self.stack['cnw']
self.assertFalse(res.check_delete_complete(res.network()))
@utils.stack_delete_after
def test_delete_not_found(self, mock_client):
self._setup_stack(mock_client)
self.fake_cnw.networks = []

View File

@ -170,7 +170,6 @@ class CeilometerAlarmTest(HeatTestCase):
self.fa.alarms.create(**al).AndReturn(FakeCeilometerAlarm())
return stack
@utils.stack_delete_after
def test_mem_alarm_high_update_no_replace(self):
'''
Make sure that we can change the update-able properties
@ -211,7 +210,6 @@ class CeilometerAlarmTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_mem_alarm_high_update_replace(self):
'''
Make sure that the Alarm resource IS replaced when non-update-able
@ -236,7 +234,6 @@ class CeilometerAlarmTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_mem_alarm_suspend_resume(self):
"""
Make sure that the Alarm resource gets disabled on suspend
@ -262,7 +259,6 @@ class CeilometerAlarmTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_mem_alarm_high_correct_int_parameters(self):
self.stack = self.create_stack(not_string_alarm_template)

View File

@ -49,12 +49,10 @@ class CloudWatchAlarmTest(common.HeatTestCase):
self.stack = utils.parse_stack(t)
return self.stack
@utils.stack_delete_after
def test_resource_create_good(self):
s = self.parse_stack()
self.assertIsNone(scheduler.TaskRunner(s['test_me'].create)())
@utils.stack_delete_after
def test_resource_create_failed(self):
s = self.parse_stack()
with patch.object(watchrule.WatchRule, 'store') as bad_store:
@ -62,13 +60,11 @@ class CloudWatchAlarmTest(common.HeatTestCase):
task_func = scheduler.TaskRunner(s['test_me'].create)
self.assertRaises(exception.ResourceFailure, task_func)
@utils.stack_delete_after
def test_resource_delete_good(self):
s = self.parse_stack()
self.assertIsNone(scheduler.TaskRunner(s['test_me'].create)())
self.assertIsNone(scheduler.TaskRunner(s['test_me'].delete)())
@utils.stack_delete_after
def test_resource_delete_notfound(self):
# if a resource is not found, handle_delete() should not raise
# an exception.

View File

@ -593,7 +593,6 @@ class StackTest(test_parser.StackTest):
def resolve(self, snippet):
return function.resolve(self.stack.t.parse(self.stack, snippet))
@utils.stack_delete_after
def test_get_attr_multiple_rsrc_status(self):
"""Test resolution of get_attr occurrences in HOT template."""
@ -620,7 +619,6 @@ class StackTest(test_parser.StackTest):
# resource name.
self.assertEqual({'Value': 'resource1'}, self.resolve(snippet))
@utils.stack_delete_after
def test_get_attr_invalid(self):
"""Test resolution of get_attr occurrences in HOT template."""
@ -635,7 +633,6 @@ class StackTest(test_parser.StackTest):
self.resolve,
{'Value': {'get_attr': ['resource1', 'NotThere']}})
@utils.stack_delete_after
def test_get_attr_invalid_resource(self):
"""Test resolution of get_attr occurrences in HOT template."""
@ -652,7 +649,6 @@ class StackTest(test_parser.StackTest):
self.assertRaises(exception.InvalidTemplateAttribute,
self.resolve, snippet)
@utils.stack_delete_after
def test_get_resource(self):
"""Test resolution of get_resource occurrences in HOT template."""
@ -667,7 +663,6 @@ class StackTest(test_parser.StackTest):
snippet = {'value': {'get_resource': 'resource1'}}
self.assertEqual({'value': 'resource1'}, self.resolve(snippet))
@utils.stack_delete_after
def test_set_param_id(self):
tmpl = parser.Template(hot_tpl_empty)
self.stack = parser.Stack(self.ctx, 'param_id_test', tmpl)
@ -686,7 +681,6 @@ class StackTest(test_parser.StackTest):
self.assertFalse(params.set_stack_id(None))
self.assertTrue(params.set_stack_id(stack_id))
@utils.stack_delete_after
def test_set_param_id_update(self):
tmpl = template.Template(
{'heat_template_version': '2013-05-23',
@ -715,7 +709,6 @@ class StackTest(test_parser.StackTest):
self.assertEqual(self.stack['AResource'].metadata['Bar'], stack_id)
@utils.stack_delete_after
def test_load_param_id(self):
tmpl = parser.Template(hot_tpl_empty)
self.stack = parser.Stack(self.ctx, 'param_load_id_test', tmpl)
@ -728,7 +721,6 @@ class StackTest(test_parser.StackTest):
self.assertEqual(newstack.parameters['OS::stack_id'],
stack_identifier.stack_id)
@utils.stack_delete_after
def test_update_modify_param_ok_replace(self):
tmpl = {
'heat_template_version': '2013-05-23',
@ -848,7 +840,6 @@ class StackAttributesTest(HeatTestCase):
expected={'Value': None}))
]
@utils.stack_delete_after
def test_get_attr(self):
"""Test resolution of get_attr occurrences in HOT template."""

View File

@ -163,7 +163,6 @@ class MetadataRefreshTest(HeatTestCase):
return stack
@utils.stack_delete_after
def test_FnGetAtt(self):
self.stack = self.create_stack()
@ -244,7 +243,6 @@ class WaitCondMetadataUpdateTest(HeatTestCase):
return stack
@utils.stack_delete_after
def test_wait_meta(self):
'''
1 create stack

View File

@ -1020,7 +1020,6 @@ class PoolUpdateHealthMonitorsTest(HeatTestCase):
neutronclient.Client.show_vip('xyz').AndReturn(
{'vip': {'status': 'ACTIVE'}})
@utils.stack_delete_after
def test_update_pool_with_references_to_health_monitors(self):
self._create_pool_with_health_monitors()
@ -1042,7 +1041,6 @@ class PoolUpdateHealthMonitorsTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_pool_with_empty_list_of_health_monitors(self):
self._create_pool_with_health_monitors()
@ -1065,7 +1063,6 @@ class PoolUpdateHealthMonitorsTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_pool_without_health_monitors(self):
self._create_pool_with_health_monitors()

View File

@ -123,7 +123,6 @@ Resources:
self.assertEqual(ref_id, rsrc.FnGetRefId())
self.assertEqual(metadata, dict(rsrc.metadata))
@utils.stack_delete_after
def test_security_group(self):
show_created = {'security_group': {
@ -543,7 +542,6 @@ Resources:
stack.delete()
self.m.VerifyAll()
@utils.stack_delete_after
def test_security_group_exception(self):
#create script
clients.OpenStackClients.keystone().AndReturn(
@ -759,7 +757,6 @@ Resources:
self.m.VerifyAll()
@utils.stack_delete_after
def test_security_group_validate(self):
stack = self.create_stack(self.test_template_validate)
sg = stack['the_sg']

View File

@ -165,7 +165,6 @@ class VPNServiceTest(HeatTestCase):
snippet['Resources']['VPNService'],
self.stack)
@utils.stack_delete_after
def test_create(self):
rsrc = self.create_vpnservice()
self.m.ReplayAll()
@ -173,7 +172,6 @@ class VPNServiceTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_failed(self):
clients.OpenStackClients.keystone().AndReturn(
fakes.FakeKeystoneClient())
@ -193,7 +191,6 @@ class VPNServiceTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete(self):
neutronclient.Client.delete_vpnservice('vpn123')
neutronclient.Client.show_vpnservice('vpn123').AndRaise(
@ -205,7 +202,6 @@ class VPNServiceTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_already_gone(self):
neutronclient.Client.delete_vpnservice('vpn123').AndRaise(
vpnservice.NeutronClientException(status_code=404))
@ -216,7 +212,6 @@ class VPNServiceTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_failed(self):
neutronclient.Client.delete_vpnservice('vpn123').AndRaise(
vpnservice.NeutronClientException(status_code=400))
@ -231,7 +226,6 @@ class VPNServiceTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute(self):
rsrc = self.create_vpnservice()
neutronclient.Client.show_vpnservice('vpn123').MultipleTimes(
@ -245,7 +239,6 @@ class VPNServiceTest(HeatTestCase):
self.assertEqual('sub123', rsrc.FnGetAtt('subnet_id'))
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute_failed(self):
rsrc = self.create_vpnservice()
self.m.ReplayAll()
@ -258,7 +251,6 @@ class VPNServiceTest(HeatTestCase):
str(error))
self.m.VerifyAll()
@utils.stack_delete_after
def test_update(self):
rsrc = self.create_vpnservice()
neutronclient.Client.update_vpnservice(
@ -321,7 +313,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
snippet['Resources']['IPsecSiteConnection'],
self.stack)
@utils.stack_delete_after
def test_create(self):
rsrc = self.create_ipsec_site_connection()
self.m.ReplayAll()
@ -329,7 +320,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_failed(self):
clients.OpenStackClients.keystone().AndReturn(
fakes.FakeKeystoneClient())
@ -351,7 +341,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete(self):
neutronclient.Client.delete_ipsec_site_connection('con123')
neutronclient.Client.show_ipsec_site_connection('con123').AndRaise(
@ -363,7 +352,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_already_gone(self):
neutronclient.Client.delete_ipsec_site_connection('con123').AndRaise(
vpnservice.NeutronClientException(status_code=404))
@ -374,7 +362,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_failed(self):
neutronclient.Client.delete_ipsec_site_connection('con123').AndRaise(
vpnservice.NeutronClientException(status_code=400))
@ -389,7 +376,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute(self):
rsrc = self.create_ipsec_site_connection()
neutronclient.Client.show_ipsec_site_connection(
@ -413,7 +399,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
self.assertEqual('vpn123', rsrc.FnGetAtt('vpnservice_id'))
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute_failed(self):
rsrc = self.create_ipsec_site_connection()
self.m.ReplayAll()
@ -426,7 +411,6 @@ class IPsecSiteConnectionTest(HeatTestCase):
str(error))
self.m.VerifyAll()
@utils.stack_delete_after
def test_update(self):
rsrc = self.create_ipsec_site_connection()
neutronclient.Client.update_ipsec_site_connection(
@ -478,7 +462,6 @@ class IKEPolicyTest(HeatTestCase):
snippet['Resources']['IKEPolicy'],
self.stack)
@utils.stack_delete_after
def test_create(self):
rsrc = self.create_ikepolicy()
self.m.ReplayAll()
@ -486,7 +469,6 @@ class IKEPolicyTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_failed(self):
clients.OpenStackClients.keystone().AndReturn(
fakes.FakeKeystoneClient())
@ -508,7 +490,6 @@ class IKEPolicyTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete(self):
neutronclient.Client.delete_ikepolicy('ike123')
neutronclient.Client.show_ikepolicy('ike123').AndRaise(
@ -520,7 +501,6 @@ class IKEPolicyTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_already_gone(self):
neutronclient.Client.delete_ikepolicy('ike123').AndRaise(
vpnservice.NeutronClientException(status_code=404))
@ -531,7 +511,6 @@ class IKEPolicyTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_failed(self):
neutronclient.Client.delete_ikepolicy('ike123').AndRaise(
vpnservice.NeutronClientException(status_code=400))
@ -546,7 +525,6 @@ class IKEPolicyTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute(self):
rsrc = self.create_ikepolicy()
neutronclient.Client.show_ikepolicy(
@ -564,7 +542,6 @@ class IKEPolicyTest(HeatTestCase):
self.assertEqual('v1', rsrc.FnGetAtt('ike_version'))
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute_failed(self):
rsrc = self.create_ikepolicy()
self.m.ReplayAll()
@ -577,7 +554,6 @@ class IKEPolicyTest(HeatTestCase):
str(error))
self.m.VerifyAll()
@utils.stack_delete_after
def test_update(self):
rsrc = self.create_ikepolicy()
neutronclient.Client.update_ikepolicy('ike123',
@ -630,7 +606,6 @@ class IPsecPolicyTest(HeatTestCase):
snippet['Resources']['IPsecPolicy'],
self.stack)
@utils.stack_delete_after
def test_create(self):
rsrc = self.create_ipsecpolicy()
self.m.ReplayAll()
@ -638,7 +613,6 @@ class IPsecPolicyTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_failed(self):
clients.OpenStackClients.keystone().AndReturn(
fakes.FakeKeystoneClient())
@ -660,7 +634,6 @@ class IPsecPolicyTest(HeatTestCase):
self.assertEqual((rsrc.CREATE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete(self):
neutronclient.Client.delete_ipsecpolicy('ips123')
neutronclient.Client.show_ipsecpolicy('ips123').AndRaise(
@ -672,7 +645,6 @@ class IPsecPolicyTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_already_gone(self):
neutronclient.Client.delete_ipsecpolicy('ips123').AndRaise(
vpnservice.NeutronClientException(status_code=404))
@ -683,7 +655,6 @@ class IPsecPolicyTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.COMPLETE), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_failed(self):
neutronclient.Client.delete_ipsecpolicy('ips123').AndRaise(
vpnservice.NeutronClientException(status_code=400))
@ -698,7 +669,6 @@ class IPsecPolicyTest(HeatTestCase):
self.assertEqual((rsrc.DELETE, rsrc.FAILED), rsrc.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute(self):
rsrc = self.create_ipsecpolicy()
neutronclient.Client.show_ipsecpolicy(
@ -716,7 +686,6 @@ class IPsecPolicyTest(HeatTestCase):
self.assertEqual('group5', rsrc.FnGetAtt('pfs'))
self.m.VerifyAll()
@utils.stack_delete_after
def test_attribute_failed(self):
rsrc = self.create_ipsecpolicy()
self.m.ReplayAll()
@ -729,7 +698,6 @@ class IPsecPolicyTest(HeatTestCase):
str(error))
self.m.VerifyAll()
@utils.stack_delete_after
def test_update(self):
rsrc = self.create_ipsecpolicy()
neutronclient.Client.update_ipsecpolicy(

View File

@ -109,7 +109,6 @@ class NotificationTest(common.HeatTestCase):
'stack_name': self.stack_name,
'state': '%s_COMPLETE' % action.upper()})]
@utils.stack_delete_after
def test_create_stack(self):
with mock.patch('heat.openstack.common.notifier.api.notify') \
as mock_notify:
@ -120,7 +119,6 @@ class NotificationTest(common.HeatTestCase):
self.assertEqual(self.expected['create'],
mock_notify.call_args_list)
@utils.stack_delete_after
def test_create_and_suspend_stack(self):
with mock.patch('heat.openstack.common.notifier.api.notify') \
as mock_notify:
@ -137,7 +135,6 @@ class NotificationTest(common.HeatTestCase):
expected = self.expected['create'] + self.expected['suspend']
self.assertEqual(expected, mock_notify.call_args_list)
@utils.stack_delete_after
def test_create_and_delete_stack(self):
with mock.patch('heat.openstack.common.notifier.api.notify') \
as mock_notify:
@ -271,7 +268,6 @@ class ScaleNotificationTest(common.HeatTestCase):
return expected
@utils.stack_delete_after
def test_scale_success(self):
with mock.patch('heat.engine.notification.stack.send'):
with mock.patch('heat.openstack.common.notifier.api.notify') \
@ -297,7 +293,6 @@ class ScaleNotificationTest(common.HeatTestCase):
self.assertEqual(1, len(group.get_instance_names()))
mock_notify.assert_has_calls(expected)
@utils.stack_delete_after
def test_scaleup_failure(self):
with mock.patch('heat.engine.notification.stack.send'):
with mock.patch('heat.openstack.common.notifier.api.notify') \

View File

@ -983,7 +983,6 @@ class StackTest(HeatTestCase):
self.stack.store()
self.stack.create()
@utils.stack_delete_after
def test_total_resources_nested(self):
self._setup_nested('zyzzyx')
self.assertEqual(4, self.stack.total_resources())
@ -994,7 +993,6 @@ class StackTest(HeatTestCase):
4,
self.stack['A'].nested().root_stack.total_resources())
@utils.stack_delete_after
def test_root_stack(self):
self._setup_nested('toor')
self.assertEqual(self.stack, self.stack.root_stack)
@ -1002,7 +1000,6 @@ class StackTest(HeatTestCase):
self.assertEqual(
self.stack, self.stack['A'].nested().root_stack)
@utils.stack_delete_after
def test_load_parent_resource(self):
self.stack = parser.Stack(self.ctx, 'load_parent_resource',
parser.Template({}))
@ -1036,7 +1033,6 @@ class StackTest(HeatTestCase):
# Note tests creating a stack should be decorated with @stack_delete_after
# to ensure the self.stack is properly cleaned up
@utils.stack_delete_after
def test_identifier(self):
self.stack = parser.Stack(self.ctx, 'identifier_test',
parser.Template({}))
@ -1047,7 +1043,6 @@ class StackTest(HeatTestCase):
self.assertTrue(identifier.stack_id)
self.assertFalse(identifier.path)
@utils.stack_delete_after
def test_get_stack_abandon_data(self):
tpl = {'Resources':
{'A': {'Type': 'GenericResourceType'},
@ -1069,7 +1064,6 @@ class StackTest(HeatTestCase):
self.assertIsNone(info['status'])
self.assertEqual(tpl, info['template'])
@utils.stack_delete_after
def test_set_param_id(self):
self.stack = parser.Stack(self.ctx, 'param_arn_test',
parser.Template({}))
@ -1085,7 +1079,6 @@ class StackTest(HeatTestCase):
identifier.arn())
self.m.VerifyAll()
@utils.stack_delete_after
def test_set_param_id_update(self):
tmpl = {'Resources': {
'AResource': {'Type': 'ResourceWithPropsType',
@ -1116,7 +1109,6 @@ class StackTest(HeatTestCase):
self.assertEqual(stack_arn, self.stack['AResource'].metadata['Bar'])
@utils.stack_delete_after
def test_load_param_id(self):
self.stack = parser.Stack(self.ctx, 'param_load_arn_test',
parser.Template({}))
@ -1128,7 +1120,6 @@ class StackTest(HeatTestCase):
newstack = parser.Stack.load(self.ctx, stack_id=self.stack.id)
self.assertEqual(identifier.arn(), newstack.parameters['AWS::StackId'])
@utils.stack_delete_after
def test_load_reads_tenant_id(self):
self.ctx.tenant_id = 'foobar'
self.stack = parser.Stack(self.ctx, 'stack_name', parser.Template({}))
@ -1138,7 +1129,6 @@ class StackTest(HeatTestCase):
stack = parser.Stack.load(self.ctx, stack_id=stack_id)
self.assertEqual('foobar', stack.tenant_id)
@utils.stack_delete_after
def test_created_time(self):
self.stack = parser.Stack(self.ctx, 'creation_time_test',
parser.Template({}))
@ -1146,7 +1136,6 @@ class StackTest(HeatTestCase):
self.stack.store()
self.assertIsNotNone(self.stack.created_time)
@utils.stack_delete_after
def test_updated_time(self):
self.stack = parser.Stack(self.ctx, 'updated_time_test',
parser.Template({}))
@ -1160,7 +1149,6 @@ class StackTest(HeatTestCase):
self.stack.update(newstack)
self.assertIsNotNone(self.stack.updated_time)
@utils.stack_delete_after
def test_access_policy_update(self):
tmpl = {'Resources': {
'R1': {'Type': 'GenericResourceType'},
@ -1195,7 +1183,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.UPDATE, parser.Stack.COMPLETE),
self.stack.state)
@utils.stack_delete_after
def test_delete(self):
self.stack = parser.Stack(self.ctx, 'delete_test',
parser.Template({}))
@ -1211,7 +1198,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.DELETE, parser.Stack.COMPLETE),
self.stack.state)
@utils.stack_delete_after
def test_delete_user_creds(self):
self.stack = parser.Stack(self.ctx, 'delete_test',
parser.Template({}))
@ -1235,7 +1221,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.DELETE, parser.Stack.COMPLETE),
self.stack.state)
@utils.stack_delete_after
def test_delete_trust(self):
cfg.CONF.set_override('deferred_auth_method', 'trusts')
@ -1258,7 +1243,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.DELETE, parser.Stack.COMPLETE),
self.stack.state)
@utils.stack_delete_after
def test_delete_trust_backup(self):
cfg.CONF.set_override('deferred_auth_method', 'trusts')
@ -1285,7 +1269,6 @@ class StackTest(HeatTestCase):
self.assertEqual(self.stack.state,
(parser.Stack.DELETE, parser.Stack.COMPLETE))
@utils.stack_delete_after
def test_delete_trust_fail(self):
cfg.CONF.set_override('deferred_auth_method', 'trusts')
@ -1313,7 +1296,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.assertIn('Error deleting trust', self.stack.status_reason)
@utils.stack_delete_after
def test_suspend_resume(self):
self.m.ReplayAll()
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -1336,7 +1318,6 @@ class StackTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_suspend_stack_suspended_ok(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
self.stack = parser.Stack(self.ctx, 'suspend_test',
@ -1359,7 +1340,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_resume_stack_resumeed_ok(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
self.stack = parser.Stack(self.ctx, 'suspend_test',
@ -1386,7 +1366,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_suspend_fail(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_suspend')
@ -1410,7 +1389,6 @@ class StackTest(HeatTestCase):
self.stack.status_reason)
self.m.VerifyAll()
@utils.stack_delete_after
def test_resume_fail(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_resume')
@ -1438,7 +1416,6 @@ class StackTest(HeatTestCase):
self.stack.status_reason)
self.m.VerifyAll()
@utils.stack_delete_after
def test_suspend_timeout(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_suspend')
@ -1461,7 +1438,6 @@ class StackTest(HeatTestCase):
self.assertEqual('Suspend timed out', self.stack.status_reason)
self.m.VerifyAll()
@utils.stack_delete_after
def test_resume_timeout(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
self.m.StubOutWithMock(generic_rsrc.GenericResource, 'handle_resume')
@ -1490,7 +1466,6 @@ class StackTest(HeatTestCase):
self.assertEqual('Resume timed out', self.stack.status_reason)
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_rollback(self):
self.stack = parser.Stack(self.ctx, 'delete_rollback_test',
parser.Template({}), disable_rollback=False)
@ -1506,7 +1481,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.ROLLBACK, parser.Stack.COMPLETE),
self.stack.state)
@utils.stack_delete_after
def test_delete_badaction(self):
self.stack = parser.Stack(self.ctx, 'delete_badaction_test',
parser.Template({}))
@ -1522,7 +1496,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.DELETE, parser.Stack.FAILED),
self.stack.state)
@utils.stack_delete_after
def test_adopt_stack(self):
adopt_data = '''{
"action": "CREATE",
@ -1562,7 +1535,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.assertEqual('AResource', self.stack.output('TestOutput'))
@utils.stack_delete_after
def test_adopt_stack_fails(self):
adopt_data = '''{
"action": "CREATE",
@ -1588,7 +1560,6 @@ class StackTest(HeatTestCase):
' provided.')
self.assertEqual(expected, self.stack.status_reason)
@utils.stack_delete_after
def test_adopt_stack_rollback(self):
adopt_data = '''{
"name": "my-test-stack-name",
@ -1611,7 +1582,6 @@ class StackTest(HeatTestCase):
self.assertEqual((self.stack.ROLLBACK, self.stack.COMPLETE),
self.stack.state)
@utils.stack_delete_after
def test_update_badstate(self):
self.stack = parser.Stack(self.ctx, 'test_stack', parser.Template({}),
action=parser.Stack.CREATE,
@ -1623,7 +1593,6 @@ class StackTest(HeatTestCase):
self.assertEqual((parser.Stack.UPDATE, parser.Stack.FAILED),
self.stack.state)
@utils.stack_delete_after
def test_resource_by_refid(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -1656,7 +1625,6 @@ class StackTest(HeatTestCase):
finally:
rsrc.state_set(rsrc.CREATE, rsrc.COMPLETE)
@utils.stack_delete_after
def test_update_add(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -1677,7 +1645,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.assertIn('BResource', self.stack)
@utils.stack_delete_after
def test_update_remove(self):
tmpl = {'Resources': {
'AResource': {'Type': 'GenericResourceType'},
@ -1699,7 +1666,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.assertNotIn('BResource', self.stack)
@utils.stack_delete_after
def test_update_description(self):
tmpl = {'Description': 'ATemplate',
'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -1722,7 +1688,6 @@ class StackTest(HeatTestCase):
self.assertEqual('BTemplate',
self.stack.t[self.stack.t.DESCRIPTION])
@utils.stack_delete_after
def test_update_timeout(self):
tmpl = {'HeatTemplateFormatVersion': '2012-12-12',
'Description': 'ATemplate',
@ -1746,7 +1711,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.assertEqual(30, self.stack.timeout_mins)
@utils.stack_delete_after
def test_update_disable_rollback(self):
tmpl = {'Description': 'ATemplate',
'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -1770,7 +1734,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.assertEqual(True, self.stack.disable_rollback)
@utils.stack_delete_after
def test_update_modify_ok_replace(self):
tmpl = {'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}}}
@ -1799,7 +1762,6 @@ class StackTest(HeatTestCase):
self.assertEqual('xyz', self.stack['AResource'].properties['Foo'])
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_modify_param_ok_replace(self):
tmpl = {
'HeatTemplateFormatVersion': '2012-12-12',
@ -1846,7 +1808,6 @@ class StackTest(HeatTestCase):
self.assertEqual('xyz', self.stack['AResource'].properties['Foo'])
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_modify_update_failed(self):
tmpl = {'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}}}
@ -1883,7 +1844,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_modify_replace_failed_delete(self):
tmpl = {'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}}}
@ -1918,7 +1878,6 @@ class StackTest(HeatTestCase):
# Unset here so destroy() is not stubbed for stack.delete cleanup
self.m.UnsetStubs()
@utils.stack_delete_after
def test_update_modify_replace_failed_create(self):
tmpl = {'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}}}
@ -1951,7 +1910,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_add_failed_create(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -1984,7 +1942,6 @@ class StackTest(HeatTestCase):
self.assertIn('BResource', re_stack)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_rollback(self):
tmpl = {'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}}}
@ -2020,7 +1977,6 @@ class StackTest(HeatTestCase):
self.assertEqual('abc', self.stack['AResource'].properties['Foo'])
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_rollback_fail(self):
tmpl = {'Resources': {'AResource': {'Type': 'ResourceWithPropsType',
'Properties': {'Foo': 'abc'}}}}
@ -2057,7 +2013,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_rollback_add(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'}}}
@ -2089,7 +2044,6 @@ class StackTest(HeatTestCase):
self.assertNotIn('BResource', self.stack)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_rollback_remove(self):
tmpl = {'Resources': {
'AResource': {'Type': 'GenericResourceType'},
@ -2123,7 +2077,6 @@ class StackTest(HeatTestCase):
# Unset here so delete() is not stubbed for stack.delete cleanup
self.m.UnsetStubs()
@utils.stack_delete_after
def test_update_rollback_replace(self):
tmpl = {'Resources': {
'AResource': {'Type': 'ResourceWithPropsType',
@ -2158,7 +2111,6 @@ class StackTest(HeatTestCase):
# Unset here so delete() is not stubbed for stack.delete cleanup
self.m.UnsetStubs()
@utils.stack_delete_after
def test_update_replace_by_reference(self):
'''
assertion:
@ -2212,7 +2164,6 @@ class StackTest(HeatTestCase):
self.assertEqual('inst-007', self.stack['BResource'].properties['Foo'])
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_with_new_resources_with_reference(self):
'''
assertion:
@ -2264,7 +2215,6 @@ class StackTest(HeatTestCase):
self.assertEqual(3, len(self.stack.resources))
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_by_reference_and_rollback_1(self):
'''
assertion:
@ -2325,7 +2275,6 @@ class StackTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_by_reference_and_rollback_2(self):
'''
assertion:
@ -2395,7 +2344,6 @@ class StackTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_replace_parameters(self):
'''
assertion:
@ -2553,7 +2501,6 @@ class StackTest(HeatTestCase):
self.assertRaises(ValueError, parser.Stack, self.ctx, '#test',
parser.Template({}))
@utils.stack_delete_after
def test_resource_state_get_att(self):
tmpl = {
'Resources': {'AResource': {'Type': 'GenericResourceType'}},
@ -2593,7 +2540,6 @@ class StackTest(HeatTestCase):
rsrc.state_set(action, status)
self.assertIsNone(self.stack.output('TestOutput'))
@utils.stack_delete_after
def test_resource_required_by(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'},
'BResource': {'Type': 'GenericResourceType',
@ -2619,7 +2565,6 @@ class StackTest(HeatTestCase):
for r in ['CResource', 'DResource']:
self.assertIn(r, required_by)
@utils.stack_delete_after
def test_resource_multi_required_by(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'},
'BResource': {'Type': 'GenericResourceType'},
@ -2640,7 +2585,6 @@ class StackTest(HeatTestCase):
self.assertEqual(['DResource'],
self.stack[r].required_by())
@utils.stack_delete_after
def test_store_saves_owner(self):
"""
The owner_id attribute of Store is saved to the database when stored.
@ -2654,7 +2598,6 @@ class StackTest(HeatTestCase):
db_stack = db_api.stack_get(self.ctx, stack_ownee.id)
self.assertEqual(self.stack.id, db_stack.owner_id)
@utils.stack_delete_after
def test_store_saves_creds(self):
"""
A user_creds entry is created on first stack store
@ -2679,7 +2622,6 @@ class StackTest(HeatTestCase):
self.stack.store()
self.assertEqual(user_creds_id, db_stack.user_creds_id)
@utils.stack_delete_after
def test_store_saves_creds_trust(self):
"""
A user_creds entry is created on first stack store
@ -2713,7 +2655,6 @@ class StackTest(HeatTestCase):
self.stack.store()
self.assertEqual(user_creds_id, db_stack.user_creds_id)
@utils.stack_delete_after
def test_load_honors_owner(self):
"""
Loading a stack from the database will set the owner_id of the
@ -2729,7 +2670,6 @@ class StackTest(HeatTestCase):
saved_stack = parser.Stack.load(self.ctx, stack_id=stack_ownee.id)
self.assertEqual(self.stack.id, saved_stack.owner_id)
@utils.stack_delete_after
def test_requires_deferred_auth(self):
tmpl = {'Resources': {'AResource': {'Type': 'GenericResourceType'},
'BResource': {'Type': 'GenericResourceType'},
@ -2744,7 +2684,6 @@ class StackTest(HeatTestCase):
self.stack['CResource'].requires_deferred_auth = True
self.assertTrue(self.stack.requires_deferred_auth())
@utils.stack_delete_after
def test_stack_user_project_id_default(self):
self.stack = parser.Stack(self.ctx, 'user_project_none',
template.Template({}))
@ -2753,7 +2692,6 @@ class StackTest(HeatTestCase):
db_stack = db_api.stack_get(self.ctx, self.stack.id)
self.assertIsNone(db_stack.stack_user_project_id)
@utils.stack_delete_after
def test_stack_user_project_id_constructor(self):
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
clients.OpenStackClients.keystone().AndReturn(FakeKeystoneClient())
@ -2772,7 +2710,6 @@ class StackTest(HeatTestCase):
self.stack.state)
self.m.VerifyAll()
@utils.stack_delete_after
def test_stack_user_project_id_delete_fail(self):
class FakeKeystoneClientFail(FakeKeystoneClient):
@ -2797,7 +2734,6 @@ class StackTest(HeatTestCase):
self.assertIn('Error deleting project', self.stack.status_reason)
self.m.VerifyAll()
@utils.stack_delete_after
def test_stack_user_project_id_setter(self):
self.m.StubOutWithMock(clients.OpenStackClients, 'keystone')
clients.OpenStackClients.keystone().AndReturn(FakeKeystoneClient())

View File

@ -687,7 +687,6 @@ Outputs:
self.assertEqual((stack.CREATE, stack.COMPLETE), stack.state)
return stack
@utils.stack_delete_after
def test_template_resource_update_template_schema(self):
stack = self.create_stack()
self.stack = stack

View File

@ -158,7 +158,6 @@ class ResourceGroupTest(common.HeatTestCase):
resgrp = resource_group.ResourceGroup('test', snip, stack)
self.assertIsNone(resgrp.validate())
@utils.stack_delete_after
def test_delete(self):
"""Test basic delete."""
resg = self._create_dummy_stack()
@ -167,7 +166,6 @@ class ResourceGroupTest(common.HeatTestCase):
self.assertEqual((resg.DELETE, resg.COMPLETE), resg.nested().state)
self.assertEqual((resg.DELETE, resg.COMPLETE), resg.state)
@utils.stack_delete_after
def test_update(self):
"""Test basic update."""
resg = self._create_dummy_stack()
@ -179,7 +177,6 @@ class ResourceGroupTest(common.HeatTestCase):
self.assertEqual((resg.UPDATE, resg.COMPLETE), resg.nested().state)
self.assertEqual(3, len(resg.nested()))
@utils.stack_delete_after
def test_aggregate_attribs(self):
"""
Test attribute aggregation and that we mimic the nested resource's
@ -190,7 +187,6 @@ class ResourceGroupTest(common.HeatTestCase):
self.assertEqual(expected, resg.FnGetAtt('foo'))
self.assertEqual(expected, resg.FnGetAtt('Foo'))
@utils.stack_delete_after
def test_aggregate_refs(self):
"""
Test resource id aggregation
@ -199,7 +195,6 @@ class ResourceGroupTest(common.HeatTestCase):
expected = ['ID-0', 'ID-1']
self.assertEqual(expected, resg.FnGetAtt("refs"))
@utils.stack_delete_after
def test_index_refs(self):
"""Tests getting ids of individual resources."""
resg = self._create_dummy_stack()

View File

@ -164,7 +164,6 @@ Resources:
self.assertEqual(ref_id, rsrc.FnGetRefId())
self.assertEqual(metadata, dict(rsrc.metadata))
@utils.stack_delete_after
def test_security_group_nova(self):
#create script
clients.OpenStackClients.nova('compute').AndReturn(self.fc)
@ -266,7 +265,6 @@ Resources:
stack.delete()
self.m.VerifyAll()
@utils.stack_delete_after
def test_security_group_nova_bad_source_group(self):
#create script
clients.OpenStackClients.nova('compute').AndReturn(self.fc)
@ -337,7 +335,6 @@ Resources:
stack.delete()
self.m.VerifyAll()
@utils.stack_delete_after
def test_security_group_nova_exception(self):
#create script
clients.OpenStackClients.nova('compute').AndReturn(self.fc)
@ -467,7 +464,6 @@ Resources:
sg = stack['the_sg']
self.assertRaises(exception.EgressRuleNotAllowed, sg.validate)
@utils.stack_delete_after
def test_security_group_neutron(self):
#create script
clients.OpenStackClients.keystone().AndReturn(
@ -716,7 +712,6 @@ Resources:
stack.delete()
self.m.VerifyAll()
@utils.stack_delete_after
def test_security_group_neutron_exception(self):
#create script
clients.OpenStackClients.keystone().AndReturn(

View File

@ -88,7 +88,6 @@ class SignalTest(HeatTestCase):
return stack
@utils.stack_delete_after
def test_handle_create_fail_keypair_raise(self):
self.stack = self.create_stack(stack_name='create_fail_keypair')
@ -106,7 +105,6 @@ class SignalTest(HeatTestCase):
self.assertIsNone(rsrc.resource_id)
self.m.VerifyAll()
@utils.stack_delete_after
def test_resource_data(self):
self.stack = self.create_stack(stack_name='resource_data_test',
stub=False)
@ -134,7 +132,6 @@ class SignalTest(HeatTestCase):
self.assertEqual(4, len(rs_data.keys()))
self.m.VerifyAll()
@utils.stack_delete_after
def test_get_user_id(self):
self.stack = self.create_stack(stack_name='resource_data_test',
stub=False)
@ -164,7 +161,6 @@ class SignalTest(HeatTestCase):
self.assertEqual('1234', rsrc._get_user_id())
self.m.VerifyAll()
@utils.stack_delete_after
def test_FnGetAtt_Alarm_Url(self):
self.stack = self.create_stack()
@ -191,7 +187,6 @@ class SignalTest(HeatTestCase):
self.assertEqual(expected_url, rsrc.FnGetAtt('AlarmUrl'))
self.m.VerifyAll()
@utils.stack_delete_after
def test_FnGetAtt_Alarm_Url_is_cached(self):
self.stack = self.create_stack()
@ -206,7 +201,6 @@ class SignalTest(HeatTestCase):
self.assertEqual(first_url, second_url)
self.m.VerifyAll()
@utils.stack_delete_after
def test_FnGetAtt_delete(self):
self.stack = self.create_stack()
@ -224,7 +218,6 @@ class SignalTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_delete_not_found(self):
self.stack = self.create_stack(stack_name='test_delete_not_found',
stub=False)
@ -248,7 +241,6 @@ class SignalTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_signal(self):
test_d = {'Data': 'foo', 'Reason': 'bar',
'Status': 'SUCCESS', 'UniqueId': '123'}
@ -271,7 +263,6 @@ class SignalTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_signal_different_reason_types(self):
self.stack = self.create_stack()
self.stack.create()
@ -323,7 +314,6 @@ class SignalTest(HeatTestCase):
self.m.ReplayAll()
@utils.stack_delete_after
def test_signal_wrong_resource(self):
# assert that we get the correct exception when calling a
# resource.signal() that does not have a handle_signal()
@ -341,7 +331,6 @@ class SignalTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_signal_reception_wrong_state(self):
# assert that we get the correct exception when calling a
# resource.signal() that is in having a destructive action.
@ -361,7 +350,6 @@ class SignalTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_signal_reception_failed_call(self):
# assert that we get the correct exception from resource.signal()
# when resource.handle_signal() raises an exception.

View File

@ -192,7 +192,6 @@ class StackResourceTest(HeatTestCase):
self.parent_resource._validate_nested_resources,
template)
@utils.stack_delete_after
def test_create_with_template_ok(self):
self.parent_resource.create_with_template(self.templ,
{"KeyName": "key"})
@ -205,7 +204,6 @@ class StackResourceTest(HeatTestCase):
self.assertEqual(self.stack.id, self.parent_resource.resource_id)
self.assertIsNone(self.stack.timeout_mins)
@utils.stack_delete_after
def test_create_with_template_timeout_mins(self):
self.assertIsNone(self.parent_stack.timeout_mins)
self.m.StubOutWithMock(self.parent_stack, 'timeout_mins')
@ -217,7 +215,6 @@ class StackResourceTest(HeatTestCase):
self.assertEqual(100, self.stack.timeout_mins)
self.m.VerifyAll()
@utils.stack_delete_after
def test_adopt_with_template_ok(self):
adopt_data = {
"resources": {
@ -240,7 +237,6 @@ class StackResourceTest(HeatTestCase):
self.assertEqual(self.templ, self.stack.t.t)
self.assertEqual(self.stack.id, self.parent_resource.resource_id)
@utils.stack_delete_after
def test_prepare_abandon(self):
self.parent_resource.create_with_template(self.templ,
{"KeyName": "key"})
@ -256,7 +252,6 @@ class StackResourceTest(HeatTestCase):
self.assertEqual(template_format.parse(param_template),
ret['template'])
@utils.stack_delete_after
def test_create_with_template_validates(self):
"""
Creating a stack with a template validates the created stack, so that
@ -271,7 +266,6 @@ class StackResourceTest(HeatTestCase):
self.parent_resource.create_with_template,
template, {'WebServer': 'foo'})
@utils.stack_delete_after
def test_update_with_template_validates(self):
"""Updating a stack with a template validates the created stack."""
create_result = self.parent_resource.create_with_template(
@ -286,7 +280,6 @@ class StackResourceTest(HeatTestCase):
self.parent_resource.update_with_template,
template, {'WebServer': 'foo'})
@utils.stack_delete_after
def test_update_with_template_ok(self):
"""
The update_with_template method updates the nested stack with the
@ -316,7 +309,6 @@ class StackResourceTest(HeatTestCase):
self.parent_stack.context, self.stack.id)
self.assertEqual(self.parent_stack.id, saved_stack.owner_id)
@utils.stack_delete_after
def test_update_with_template_timeout_mins(self):
self.assertIsNone(self.parent_stack.timeout_mins)
self.m.StubOutWithMock(self.parent_stack, 'timeout_mins')
@ -339,7 +331,6 @@ class StackResourceTest(HeatTestCase):
self.assertEqual(200, self.stack.timeout_mins)
self.m.VerifyAll()
@utils.stack_delete_after
def test_update_with_template_files(self):
create_result = self.parent_resource.create_with_template(
self.simple_template, {})
@ -357,7 +348,6 @@ class StackResourceTest(HeatTestCase):
self.assertEqual({"foo": "bar"}, self.stack.t.files)
@utils.stack_delete_after
def test_update_with_template_state_err(self):
"""
update_with_template_state_err method should raise error when update
@ -391,7 +381,6 @@ class StackResourceTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_load_nested_ok(self):
self.parent_resource.create_with_template(self.templ,
{"KeyName": "key"})
@ -408,7 +397,6 @@ class StackResourceTest(HeatTestCase):
self.parent_resource.nested()
self.m.VerifyAll()
@utils.stack_delete_after
def test_load_nested_non_exist(self):
self.parent_resource.create_with_template(self.templ,
{"KeyName": "key"})
@ -476,7 +464,6 @@ class StackResourceTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_create_complete_state_err(self):
"""
check_create_complete should raise error when create task is
@ -525,7 +512,6 @@ class StackResourceTest(HeatTestCase):
# Restore state_set to let clean up proceed
self.stack.state_set = st_set
@utils.stack_delete_after
def test_suspend_complete_state_err(self):
"""
check_suspend_complete should raise error when suspend task is
@ -555,7 +541,6 @@ class StackResourceTest(HeatTestCase):
# Restore state_set to let clean up proceed
self.stack.state_set = st_set
@utils.stack_delete_after
def test_resume_complete_state_err(self):
"""
check_resume_complete should raise error when resume task is

View File

@ -138,7 +138,6 @@ class WaitConditionTest(HeatTestCase):
return stack
@utils.stack_delete_after
def test_post_success_to_handle(self):
self.stack = self.create_stack()
wc.WaitConditionHandle.get_status().AndReturn([])
@ -158,7 +157,6 @@ class WaitConditionTest(HeatTestCase):
self.assertEqual('WaitHandle', r.name)
self.m.VerifyAll()
@utils.stack_delete_after
def test_post_failure_to_handle(self):
self.stack = self.create_stack()
wc.WaitConditionHandle.get_status().AndReturn([])
@ -179,7 +177,6 @@ class WaitConditionTest(HeatTestCase):
self.assertEqual('WaitHandle', r.name)
self.m.VerifyAll()
@utils.stack_delete_after
def test_post_success_to_handle_count(self):
self.stack = self.create_stack(template=test_template_wc_count)
wc.WaitConditionHandle.get_status().AndReturn([])
@ -201,7 +198,6 @@ class WaitConditionTest(HeatTestCase):
self.assertEqual('WaitHandle', r.name)
self.m.VerifyAll()
@utils.stack_delete_after
def test_post_failure_to_handle_count(self):
self.stack = self.create_stack(template=test_template_wc_count)
wc.WaitConditionHandle.get_status().AndReturn([])
@ -222,7 +218,6 @@ class WaitConditionTest(HeatTestCase):
self.assertEqual('WaitHandle', r.name)
self.m.VerifyAll()
@utils.stack_delete_after
def test_timeout(self):
st = time.time()
@ -254,7 +249,6 @@ class WaitConditionTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_FnGetAtt(self):
self.stack = self.create_stack()
wc.WaitConditionHandle.get_status().AndReturn(['SUCCESS'])
@ -284,7 +278,6 @@ class WaitConditionTest(HeatTestCase):
self.assertEqual(u'{"123": "foo", "456": "dog"}', wc_att)
self.m.VerifyAll()
@utils.stack_delete_after
def test_validate_handle_url_bad_stackid(self):
self.m.ReplayAll()
@ -305,7 +298,6 @@ class WaitConditionTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_validate_handle_url_bad_stackname(self):
self.m.ReplayAll()
@ -324,7 +316,6 @@ class WaitConditionTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_validate_handle_url_bad_tenant(self):
self.m.ReplayAll()
@ -343,7 +334,6 @@ class WaitConditionTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_validate_handle_url_bad_resource(self):
self.m.ReplayAll()
@ -362,7 +352,6 @@ class WaitConditionTest(HeatTestCase):
self.m.VerifyAll()
@utils.stack_delete_after
def test_validate_handle_url_bad_resource_type(self):
self.m.ReplayAll()
stack_id = 'STACKABCD1234'
@ -423,7 +412,6 @@ class WaitConditionHandleTest(HeatTestCase):
return stack
@utils.stack_delete_after
def test_handle(self):
stack_id = 'STACKABCD1234'
stack_name = 'test_stack2'
@ -456,7 +444,6 @@ class WaitConditionHandleTest(HeatTestCase):
rsrc.handle_update, {}, {}, {})
self.m.VerifyAll()
@utils.stack_delete_after
def test_metadata_update(self):
self.stack = self.create_stack()
rsrc = self.stack['WaitHandle']
@ -471,7 +458,6 @@ class WaitConditionHandleTest(HeatTestCase):
self.assertEqual(handle_metadata, rsrc.metadata)
self.m.VerifyAll()
@utils.stack_delete_after
def test_metadata_update_invalid(self):
self.stack = self.create_stack()
rsrc = self.stack['WaitHandle']
@ -515,7 +501,6 @@ class WaitConditionHandleTest(HeatTestCase):
new_metadata=err_metadata)
self.m.VerifyAll()
@utils.stack_delete_after
def test_get_status(self):
self.stack = self.create_stack()
rsrc = self.stack['WaitHandle']
@ -542,7 +527,6 @@ class WaitConditionHandleTest(HeatTestCase):
wc.WaitConditionHandle.keystone().MultipleTimes().AndReturn(self.fc)
self.m.ReplayAll()
@utils.stack_delete_after
def test_get_status_reason(self):
self.stack = self.create_stack()
rsrc = self.stack['WaitHandle']
@ -614,7 +598,6 @@ class WaitConditionUpdateTest(HeatTestCase):
self.stack_id = stack_id
return stack
@utils.stack_delete_after
def test_update(self):
self.stack = self.create_stack()
self.m.ReplayAll()
@ -639,7 +622,6 @@ class WaitConditionUpdateTest(HeatTestCase):
self.assertEqual((rsrc.UPDATE, rsrc.COMPLETE), rsrc.state)
@utils.stack_delete_after
def test_handle_update(self):
self.stack = self.create_stack()
self.m.ReplayAll()
@ -669,7 +651,6 @@ class WaitConditionUpdateTest(HeatTestCase):
self.assertEqual(5, rsrc.properties['Count'])
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
@utils.stack_delete_after
def test_handle_update_restored_from_db(self):
self.stack = self.create_stack()
self.m.ReplayAll()
@ -709,7 +690,6 @@ class WaitConditionUpdateTest(HeatTestCase):
metadata['UniqueId'] = metadata['UniqueId'] * 2
rsrc.metadata_update(new_metadata=metadata)
@utils.stack_delete_after
def test_handle_update_timeout(self):
self.stack = self.create_stack()
self.m.ReplayAll()
@ -752,7 +732,6 @@ class WaitConditionUpdateTest(HeatTestCase):
self.m.VerifyAll()
self.m.UnsetStubs()
@utils.stack_delete_after
def test_update_updatehandle(self):
self.stack = self.create_stack(test_template_update_waitcondition)
self.m.ReplayAll()

View File

@ -11,10 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import functools
import random
import string
import sys
import uuid
import sqlalchemy
@ -47,32 +45,6 @@ def random_name():
for x in range(10))
def stack_delete_after(test_fn):
"""
Decorator which calls test class self.stack.delete()
to ensure tests clean up their stacks regardless of test success/failure
"""
@functools.wraps(test_fn)
def wrapped_test(test_case, *args, **kwargs):
def delete_stack():
stack = getattr(test_case, 'stack', None)
if stack is not None and stack.id is not None:
stack.delete()
try:
test_fn(test_case, *args, **kwargs)
except:
exc_class, exc_val, exc_tb = sys.exc_info()
try:
delete_stack()
finally:
raise exc_class, exc_val, exc_tb
else:
delete_stack()
return wrapped_test
def setup_dummy_db():
options.cfg.set_defaults(options.database_opts, sqlite_synchronous=False)
options.set_defaults(sql_connection="sqlite://", sqlite_db='heat.db')