]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Make global TemplateResources usable in the tests
authorAngus Salkeld <asalkeld@redhat.com>
Thu, 5 Sep 2013 09:50:08 +0000 (19:50 +1000)
committerSteve Baker <sbaker@redhat.com>
Fri, 6 Sep 2013 23:04:35 +0000 (11:04 +1200)
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

index f09fe8c0f308d86ff7d8caa71e022ad5b6e72cd4..ea5df9ab7a25aae27b0fb703e0a8c13409b9f9fd 100644 (file)
@@ -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)