From 5fc4d75cf52ef39149a1d5fe69de7f7019659a58 Mon Sep 17 00:00:00 2001 From: Angus Salkeld Date: Thu, 5 Sep 2013 19:50:08 +1000 Subject: [PATCH] Make global TemplateResources usable in the tests At the moment we need the templates installed into /etc/heat/templates and this is not very nice for the tests. So this patch replaces "/etc/heat/templates" with the project's own template path so we can at least test the api of the template resources. Partial-Bug: #1215797 Change-Id: Ie4924b0358b97af8feaad93ed9187976b8932e3d --- heat/tests/common.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/heat/tests/common.py b/heat/tests/common.py index f09fe8c0..ea5df9ab 100644 --- a/heat/tests/common.py +++ b/heat/tests/common.py @@ -23,6 +23,8 @@ import testtools from oslo.config import cfg import heat.engine.scheduler as scheduler +from heat.engine import environment +from heat.engine import resources class HeatTestCase(testtools.TestCase): @@ -46,3 +48,13 @@ class HeatTestCase(testtools.TestCase): cfg.CONF.set_default('environment_dir', env_dir) self.addCleanup(cfg.CONF.reset) + + tri = resources.global_env().get_resource_info( + 'AWS::RDS::DBInstance', + registry_type=environment.TemplateResourceInfo) + if tri is not None: + cur_path = tri.template_name + templ_path = os.path.join(project_dir, 'etc', 'heat', 'templates') + if templ_path not in cur_path: + tri.template_name = cur_path.replace('/etc/heat/templates', + templ_path) -- 2.45.2