diff --git a/heat/tests/common.py b/heat/tests/common.py index 9098376560..44f5221253 100644 --- a/heat/tests/common.py +++ b/heat/tests/common.py @@ -125,6 +125,8 @@ class HeatTestCase(testscenarios.WithScenarios, self.addCleanup(utils.reset_dummy_db) def register_test_resources(self): + resource._register_class('GenericResourceType', + generic_rsrc.GenericResource) resource._register_class('SignalResourceType', generic_rsrc.SignalResource) resource._register_class('ResourceWithPropsType', diff --git a/heat/tests/engine/test_stack_create.py b/heat/tests/engine/test_stack_create.py index 80f7110290..307b902887 100644 --- a/heat/tests/engine/test_stack_create.py +++ b/heat/tests/engine/test_stack_create.py @@ -20,7 +20,6 @@ from heat.engine.clients.os import glance from heat.engine.clients.os import nova from heat.engine import environment from heat.engine import properties -from heat.engine import resource as res from heat.engine.resources.aws.ec2 import instance as instances from heat.engine import service from heat.engine import stack @@ -29,7 +28,6 @@ from heat.objects import stack as stack_object from heat.openstack.common import threadgroup from heat.tests import common from heat.tests.engine import tools -from heat.tests import generic_resource as generic_rsrc from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -212,13 +210,12 @@ class StackCreateTest(common.HeatTestCase): def test_stack_create_total_resources_equals_max(self, ctr): stack_name = 'stack_create_total_resources_equals_max' params = {} - res._register_class('FakeResourceType', generic_rsrc.GenericResource) tpl = { 'heat_template_version': '2014-10-16', 'resources': { - 'A': {'type': 'FakeResourceType'}, - 'B': {'type': 'FakeResourceType'}, - 'C': {'type': 'FakeResourceType'} + 'A': {'type': 'GenericResourceType'}, + 'B': {'type': 'GenericResourceType'}, + 'C': {'type': 'GenericResourceType'} } } @@ -254,13 +251,12 @@ class StackCreateTest(common.HeatTestCase): def test_stack_create_total_resources_exceeds_max(self): stack_name = 'stack_create_total_resources_exceeds_max' params = {} - res._register_class('FakeResourceType', generic_rsrc.GenericResource) tpl = { 'heat_template_version': '2014-10-16', 'resources': { - 'A': {'type': 'FakeResourceType'}, - 'B': {'type': 'FakeResourceType'}, - 'C': {'type': 'FakeResourceType'} + 'A': {'type': 'GenericResourceType'}, + 'B': {'type': 'GenericResourceType'}, + 'C': {'type': 'GenericResourceType'} } } diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py index 40589306c4..39e51c010b 100644 --- a/heat/tests/test_engine_api_utils.py +++ b/heat/tests/test_engine_api_utils.py @@ -24,12 +24,10 @@ from heat.common import template_format from heat.engine import api from heat.engine import event from heat.engine import parameters -from heat.engine import resource from heat.engine import stack as parser from heat.engine import template from heat.rpc import api as rpc_api from heat.tests import common -from heat.tests import generic_resource as generic_rsrc from heat.tests import utils datetime = dt.datetime @@ -48,8 +46,6 @@ class FormatTest(common.HeatTestCase): 'DependsOn': 'generic1'} } }) - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) self.stack = parser.Stack(utils.dummy_context(), 'test_stack', tmpl, stack_id=str(uuid.uuid4())) diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index 5de7dd578f..3a70c17a63 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -595,8 +595,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase): environment = {'parameters': {"app_dbx": "test"}} template, adopt_data = self._get_stack_adopt_data_and_template( environment) - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) result = self.man.create_stack(self.ctx, "test_adopt_stack", template, {}, None, {'adopt_stack_data': str(adopt_data)}) @@ -614,8 +612,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase): } template, adopt_data = self._get_stack_adopt_data_and_template( environment) - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) result = self.man.create_stack(self.ctx, "test_adopt_stack", template, input_params, None, {'adopt_stack_data': str(adopt_data)}) @@ -630,8 +626,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase): env = {'parameters': {"app_dbx": "test"}} template, adopt_data = self._get_stack_adopt_data_and_template( env) - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) result = self.man.create_stack(self.ctx, "test_adopt_stack", template, {}, None, {'adopt_stack_data': str(adopt_data)}) @@ -646,8 +640,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase): environment = {'parameters': {"app_dbx": "test"}} template, adopt_data = self._get_stack_adopt_data_and_template( environment) - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) ex = self.assertRaises( dispatcher.ExpectedException, self.man.create_stack, @@ -886,8 +878,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase): def test_stack_update_equals(self, ctr): stack_name = 'test_stack_update_equals_resource_limit' params = {} - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) tpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': { 'A': {'Type': 'GenericResourceType'}, @@ -998,8 +988,6 @@ class StackServiceAdoptUpdateTest(common.HeatTestCase): def test_stack_update_exceeds_resource_limit(self): stack_name = 'test_stack_update_exceeds_resource_limit' params = {} - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) tpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': { 'A': {'Type': 'GenericResourceType'}, @@ -1481,8 +1469,6 @@ class StackServiceTest(common.HeatTestCase): @tools.stack_context('event_list_deleted_stack') def test_stack_event_list_deleted_resource(self): - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) thread = self.m.CreateMockAnything() thread.link(mox.IgnoreArg()).AndReturn(None) @@ -2798,8 +2784,6 @@ class StackServiceTest(common.HeatTestCase): def test_lazy_load_resources(self): stack_name = 'lazy_load_test' - res._register_class('GenericResourceType', - generic_rsrc.GenericResource) lazy_load_template = { 'HeatTemplateFormatVersion': '2012-12-12', diff --git a/heat/tests/test_function.py b/heat/tests/test_function.py index f8885699c7..dfb69988d7 100644 --- a/heat/tests/test_function.py +++ b/heat/tests/test_function.py @@ -161,9 +161,6 @@ class ValidateGetAttTest(common.HeatTestCase): def setUp(self): super(ValidateGetAttTest, self).setUp() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - env = environment.Environment() env.load({u'resource_registry': {u'OS::Test::GenericResource': u'GenericResourceType'}}) diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py index d27a13c76c..d0c4261dff 100644 --- a/heat/tests/test_hot.py +++ b/heat/tests/test_hot.py @@ -896,9 +896,6 @@ class HotStackTest(common.HeatTestCase): self.tmpl = template.Template(copy.deepcopy(empty_template)) self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - def resolve(self, snippet): return function.resolve(self.stack.t.parse(self.stack, snippet)) @@ -1133,9 +1130,6 @@ class StackAttributesTest(common.HeatTestCase): self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - self.m.ReplayAll() scenarios = [ @@ -1223,9 +1217,6 @@ class StackGetAttrValidationTest(common.HeatTestCase): super(StackGetAttrValidationTest, self).setUp() self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - def test_validate_props_from_attrs(self): stack = parser.Stack(self.ctx, 'test_props_from_attrs', template.Template(hot_tpl_mapped_props)) diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py index 64fa0d08e4..18b7abde75 100644 --- a/heat/tests/test_provider_template.py +++ b/heat/tests/test_provider_template.py @@ -48,8 +48,6 @@ class MyCloudResource(generic_rsrc.GenericResource): class ProviderTemplateTest(common.HeatTestCase): def setUp(self): super(ProviderTemplateTest, self).setUp() - resource._register_class('OS::ResourceType', - generic_rsrc.GenericResource) resource._register_class('myCloud::ResourceType', MyCloudResource) @@ -58,7 +56,7 @@ class ProviderTemplateTest(common.HeatTestCase): # default class. env_str = {'resource_registry': {}} env = environment.Environment(env_str) - cls = env.get_class('OS::ResourceType', 'fred') + cls = env.get_class('GenericResourceType', 'fred') self.assertEqual(generic_rsrc.GenericResource, cls) def test_get_mine_global_map(self): @@ -89,7 +87,7 @@ class ProviderTemplateTest(common.HeatTestCase): env_str = {'resource_registry': {'resources': {'jerry': { "OS::ResourceType": "myCloud::ResourceType"}}}} env = environment.Environment(env_str) - cls = env.get_class('OS::ResourceType', 'fred') + cls = env.get_class('GenericResourceType', 'fred') self.assertEqual(generic_rsrc.GenericResource, cls) def test_to_parameters(self): diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 9ab6f7a3b1..30016552ef 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -54,9 +54,6 @@ class ResourceTest(common.HeatTestCase): def setUp(self): super(ResourceTest, self).setUp() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - self.env = environment.Environment() self.env.load({u'resource_registry': {u'OS::Test::GenericResource': u'GenericResourceType', @@ -1463,10 +1460,6 @@ class ResourceTest(common.HeatTestCase): class ResourceAdoptTest(common.HeatTestCase): - def setUp(self): - super(ResourceAdoptTest, self).setUp() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) def test_adopt_resource_success(self): adopt_data = '{}' @@ -1553,9 +1546,6 @@ class ResourceDependenciesTest(common.HeatTestCase): def setUp(self): super(ResourceDependenciesTest, self).setUp() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - self.deps = dependencies.Dependencies() def test_no_deps(self): @@ -2145,9 +2135,6 @@ class ResourceHookTest(common.HeatTestCase): def setUp(self): super(ResourceHookTest, self).setUp() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - self.env = environment.Environment() self.env.load({u'resource_registry': {u'OS::Test::GenericResource': u'GenericResourceType', diff --git a/heat/tests/test_signal.py b/heat/tests/test_signal.py index df1b3ef41d..fed3f6ff98 100644 --- a/heat/tests/test_signal.py +++ b/heat/tests/test_signal.py @@ -47,10 +47,6 @@ class SignalTest(common.HeatTestCase): def setUp(self): super(SignalTest, self).setUp() - - resource._register_class('GenericResourceType', - generic_resource.GenericResource) - self.stack_id = 'STACKABCD1234' def tearDown(self): diff --git a/heat/tests/test_stack.py b/heat/tests/test_stack.py index 2711a175e1..1fceebbcf4 100644 --- a/heat/tests/test_stack.py +++ b/heat/tests/test_stack.py @@ -53,9 +53,6 @@ class StackTest(common.HeatTestCase): self.tmpl = template.Template(copy.deepcopy(empty_template)) self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - def test_stack_reads_tenant(self): self.stack = stack.Stack(self.ctx, 'test_stack', self.tmpl, tenant_id='bar') diff --git a/heat/tests/test_stack_delete.py b/heat/tests/test_stack_delete.py index 294bcdd543..1a2853e4ca 100644 --- a/heat/tests/test_stack_delete.py +++ b/heat/tests/test_stack_delete.py @@ -23,7 +23,6 @@ from heat.common import exception from heat.common import heat_keystoneclient as hkc from heat.common import template_format from heat.engine.clients.os import keystone -from heat.engine import resource from heat.engine import scheduler from heat.engine import stack from heat.engine import template @@ -46,8 +45,6 @@ class StackTest(common.HeatTestCase): self.tmpl = template.Template(copy.deepcopy(empty_template)) self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) def test_delete(self): self.stack = stack.Stack(self.ctx, 'delete_test', self.tmpl) diff --git a/heat/tests/test_stack_update.py b/heat/tests/test_stack_update.py index d15dbc3293..ed85fb1cbc 100644 --- a/heat/tests/test_stack_update.py +++ b/heat/tests/test_stack_update.py @@ -37,9 +37,6 @@ class StackUpdateTest(common.HeatTestCase): self.tmpl = template.Template(copy.deepcopy(empty_template)) self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - def test_update_add(self): tmpl = {'HeatTemplateFormatVersion': '2012-12-12', 'Resources': {'AResource': {'Type': 'GenericResourceType'}}} diff --git a/heat/tests/test_template.py b/heat/tests/test_template.py index f6909ee615..d6015ff4bb 100644 --- a/heat/tests/test_template.py +++ b/heat/tests/test_template.py @@ -28,12 +28,10 @@ from heat.engine import environment from heat.engine import function from heat.engine.hot import template as hot_t from heat.engine import parameters -from heat.engine import resource from heat.engine import rsrc_defn from heat.engine import stack from heat.engine import template from heat.tests import common -from heat.tests import generic_resource as generic_rsrc from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -381,9 +379,6 @@ class TemplateTest(common.HeatTestCase): super(TemplateTest, self).setUp() self.ctx = utils.dummy_context() - resource._register_class('GenericResourceType', - generic_rsrc.GenericResource) - @staticmethod def resolve(snippet, template, stack=None): return function.resolve(template.parse(stack, snippet))