]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Change Stack to support user defined parameter
authorJeff Peeler <jpeeler@redhat.com>
Wed, 12 Sep 2012 20:25:25 +0000 (16:25 -0400)
committerJeff Peeler <jpeeler@redhat.com>
Wed, 12 Sep 2012 20:59:44 +0000 (16:59 -0400)
This change allows tests to specify DBUsername/DBPassword if necessary.
The keyname is still looked up in nova and the distribution is retrieved
from the already existing Stack parameter.

Change-Id: I3732ffb685d68c8a72a83247f74ed11a50a74cd1
Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
heat/tests/functional/test_WordPress_Composed_Instances.py
heat/tests/functional/test_WordPress_Single_Instance.py
heat/tests/functional/test_WordPress_Single_Instance_Boto.py
heat/tests/functional/test_WordPress_Single_Instance_With_EBS.py
heat/tests/functional/test_WordPress_Single_Instance_With_EBS_EIP.py
heat/tests/functional/test_WordPress_Single_Instance_With_EIP.py
heat/tests/functional/test_WordPress_Single_Instance_With_HA.py
heat/tests/functional/test_WordPress_With_LB.py
heat/tests/functional/test_WordPress_With_RDS.py
heat/tests/functional/util.py

index b531aa372b5a01b904de2a01c3d2dbab50bf6d19..d6fb391b1078413ddae01d5ca2d35b43ab73d981 100644 (file)
@@ -17,6 +17,7 @@ import verify
 import nose
 from nose.plugins.attrib import attr
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -25,7 +26,12 @@ class WordPressComposedInstancesFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Composed_Instances.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
 
         self.WebServer = util.Instance('WebServer')
         self.WebServer.check_cfntools()
index ce89afef5f0394c1943ff0cfec3672d4b5b1ba8d..9fd8a35750fd6b3c8fec1f567c5d6c5f7cf67670 100644 (file)
@@ -17,6 +17,7 @@ import verify
 import nose
 from nose.plugins.attrib import attr
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -25,7 +26,12 @@ class WordPressFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Single_Instance.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+                         'DBUsername=dbuser',
+                         'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
         self.WikiDatabase = util.Instance('WikiDatabase')
         self.WikiDatabase.check_cfntools()
         self.WikiDatabase.wait_for_provisioning()
index 8c0a84299e1f0725b0f184a7ad9925c83e3c8dda..9fda3fad75a9dd57bcde61a6a496251e5c1846c2 100644 (file)
@@ -17,6 +17,7 @@ import verify
 import nose
 from nose.plugins.attrib import attr
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -25,7 +26,12 @@ class WordPressBotoFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Single_Instance.template'
 
-        self.stack = util.StackBoto(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.StackBoto(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
         self.WikiDatabase = util.Instance('WikiDatabase')
         self.WikiDatabase.check_cfntools()
         self.WikiDatabase.wait_for_provisioning()
index 7b198d4219ffae86f1914aa65df98c7a74ff88b1..0d8a8c483b4b4e4b2615e1be101fb0464612b7fc 100644 (file)
@@ -20,6 +20,7 @@ from nose.plugins.attrib import attr
 from heat.common import context
 from heat.engine import manager
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -29,7 +30,12 @@ class WordPressSingleEBSFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Single_Instance_With_EBS.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
         self.WikiDatabase = util.Instance('WikiDatabase')
         self.WikiDatabase.check_cfntools()
         self.WikiDatabase.wait_for_provisioning()
index 3e404ca86233e065bf55d5421c980ea73ae14ac8..dd6e93751c048899c3b6680cbf3bf704d7daaa2e 100644 (file)
@@ -20,6 +20,7 @@ from nose.plugins.attrib import attr
 from heat.common import context
 from heat.engine import manager
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -28,7 +29,12 @@ class WordPressEBSEIPFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Single_Instance_With_EBS_EIP.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
         self.WikiDatabase = util.Instance('WikiDatabase')
         self.WikiDatabase.check_cfntools()
         self.WikiDatabase.wait_for_provisioning()
index f16eb9c683c59d9ed6c163d440d7b38f9be90230..e175443dbc59d9d82b0961920340239371b3d6e5 100644 (file)
@@ -20,6 +20,7 @@ from nose.plugins.attrib import attr
 from heat.common import context
 from heat.engine import manager
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -28,7 +29,12 @@ class WordPressEIPFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Single_Instance_With_EIP.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
         self.WikiDatabase = util.Instance('WikiDatabase')
         self.WikiDatabase.check_cfntools()
         self.WikiDatabase.wait_for_provisioning()
index ab2539c9d85cd15e9e69e7ffc95e437010b081a0..cf2667451d7dbff15f24ee2b8937bbcbd70d4ff2 100644 (file)
@@ -16,6 +16,7 @@ import util
 import nose
 from nose.plugins.attrib import attr
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -25,7 +26,12 @@ class HaFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_Single_Instance_With_HA.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
         self.WikiDatabase = util.Instance('WikiDatabase')
         self.WikiDatabase.check_cfntools()
         self.WikiDatabase.wait_for_provisioning()
index 56dec55731d5c8ae284b627c2f36d124b9397082..7f11fa13c1ccefd706b334a672dfdcd8ea6989a5 100644 (file)
@@ -17,6 +17,7 @@ import verify
 import nose
 from nose.plugins.attrib import attr
 import unittest
+import os
 
 
 @attr(speed='slow')
@@ -25,7 +26,12 @@ class WordPressWithLBFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_With_LB.template'
 
-        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools')
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
+
+        self.stack = util.Stack(template, 'F17', 'x86_64', 'cfntools',
+            stack_paramstr)
 
         self.WikiServerOne = util.Instance('WikiServerOne')
         self.LBInstance = util.Instance('LB_instance')
index a82eaf1f15c5d08bf9cc7b84f9664c8091c8c97f..113a7d163b7a2d5cc63c2eca2bc2814f8bf2638a 100644 (file)
@@ -24,6 +24,9 @@ import unittest
 class WordPressRDSFunctionalTest(unittest.TestCase):
     def setUp(self):
         template = 'WordPress_With_RDS.template'
+        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
+            'DBUsername=dbuser',
+            'DBPassword=' + os.environ['OS_PASSWORD']])
 
         self.func_utils = util.FuncUtils()
 
index be2514371192d488194c6ad42525a3fa0e163447..c98e9d8c82dadb9342dc40aef1f2f2af905a92ff 100644 (file)
@@ -275,7 +275,8 @@ class Instance(object):
 
 
 class Stack(object):
-    def __init__(self, template_file, distribution, arch, jeos_type):
+    def __init__(self, template_file, distribution, arch, jeos_type,
+            stack_paramstr):
 
         self.prepare_jeos(distribution, arch, jeos_type)
 
@@ -292,13 +293,9 @@ class Stack(object):
 
         assert self.heatclient
 
-        # Dummy up the optparse.Values we get from CLI args in bin/heat
-        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
-                         'DBUsername=' + self.dbusername,
-                         'DBPassword=' + os.environ['OS_PASSWORD'],
-                         'KeyName=' + keyname,
+        full_paramstr = stack_paramstr + ';' + ';'.join(['KeyName=' + keyname,
                          'LinuxDistribution=' + distribution])
-        template_params = optparse.Values({'parameters': stack_paramstr})
+        template_params = optparse.Values({'parameters': full_paramstr})
 
         # Format parameters and create the stack
         parameters = {}
@@ -446,7 +443,8 @@ class StackBoto(Stack):
     Version of the Stack class which uses the boto client (hence AWS auth and
     the CFN API).
     '''
-    def __init__(self, template_file, distribution, arch, jeos_type):
+    def __init__(self, template_file, distribution, arch, jeos_type,
+            stack_paramstr):
 
         self.prepare_jeos(distribution, arch, jeos_type)
 
@@ -485,13 +483,9 @@ class StackBoto(Stack):
 
         assert self.heatclient
 
-        # Dummy up the optparse.Values we get from CLI args in bin/heat
-        stack_paramstr = ';'.join(['InstanceType=m1.xlarge',
-                         'DBUsername=' + self.dbusername,
-                         'DBPassword=' + os.environ['OS_PASSWORD'],
-                         'KeyName=' + keyname,
+        full_paramstr = stack_paramstr + ';' + ';'.join(['KeyName=' + keyname,
                          'LinuxDistribution=' + distribution])
-        template_params = optparse.Values({'parameters': stack_paramstr})
+        template_params = optparse.Values({'parameters': full_paramstr})
 
         # Format parameters and create the stack
         parameters = {}