]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat tests : functional tests allow non-default stackname
authorSteven Hardy <shardy@redhat.com>
Mon, 17 Sep 2012 15:54:23 +0000 (16:54 +0100)
committerSteven Hardy <shardy@redhat.com>
Mon, 17 Sep 2012 16:13:37 +0000 (17:13 +0100)
Allow the default "teststack" to be overridden, so multiple
stacks can be created in one test

Change-Id: I09a4128b98df7af6c6b85552ac2175919a697c50
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/tests/functional/util.py

index dcface9f13b7091a30d87730c1b16942835766b9..e104c1bd96d22b969a3c38699879d82504026c8d 100644 (file)
@@ -41,10 +41,12 @@ from heat import client as heat_client
 from heat import boto_client as heat_client_boto
 from keystoneclient.v2_0 import client
 
+DEFAULT_STACKNAME = 'teststack'
+
 
 class Instance(object):
-    def __init__(self, instance_name):
-        self.name = 'teststack.%s' % instance_name
+    def __init__(self, instance_name, stackname=DEFAULT_STACKNAME):
+        self.name = '%s.%s' % (stackname, instance_name)
 
         # during nose test execution this file will be imported even if
         # the unit tag was specified
@@ -63,7 +65,6 @@ class Instance(object):
                 auth_url=os.environ['OS_AUTH_URL'],
                 strategy=os.environ['OS_AUTH_STRATEGY'])
         dbusername = 'testuser'
-        stackname = 'teststack'
 
         # this test is in heat/tests/functional, so go up 3 dirs
         basepath = os.path.abspath(
@@ -288,8 +289,9 @@ class Instance(object):
 
 class Stack(object):
     def __init__(self, template_file, distribution, arch, jeos_type,
-            stack_paramstr):
+            stack_paramstr, stackname=DEFAULT_STACKNAME):
 
+        self.stackname = stackname
         self.template_file = template_file
         self.distribution = distribution
         self.stack_paramstr = stack_paramstr
@@ -368,7 +370,6 @@ class Stack(object):
             auth_url=os.environ['OS_AUTH_URL'],
             strategy=os.environ['OS_AUTH_STRATEGY'])
     dbusername = 'testuser'
-    stackname = 'teststack'
 
     # this test is in heat/tests/functional, so go up 3 dirs
     basepath = os.path.abspath(