summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/utils/tests/heat_utils_tests.py
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2017-07-25 14:40:09 -0600
committerspisarski <s.pisarski@cablelabs.com>2017-07-25 15:36:23 -0600
commitb8b14d27a2ece042553a82b82fb0a3a7f3896fdf (patch)
tree6d1e04c9336d590887fe971015cb5433cea8e50f /snaps/openstack/utils/tests/heat_utils_tests.py
parent63ee8af859678fdf7b82225d5bf40bddef90c0b3 (diff)
Added region support.
Added region_name attribute to OSCreds Added region_name to neutron, nova, glance, heat, and keystone client retrieval Fixed false positive heat connection test. JIRA: SNAPS-50 & SNAPS-146 Change-Id: If3471ed7a2bdd0e6bfc281455c996386d031235d Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/utils/tests/heat_utils_tests.py')
-rw-r--r--snaps/openstack/utils/tests/heat_utils_tests.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/snaps/openstack/utils/tests/heat_utils_tests.py b/snaps/openstack/utils/tests/heat_utils_tests.py
index 2ef0c68..dda1111 100644
--- a/snaps/openstack/utils/tests/heat_utils_tests.py
+++ b/snaps/openstack/utils/tests/heat_utils_tests.py
@@ -44,7 +44,9 @@ class HeatSmokeTests(OSComponentTestCase):
heat = heat_utils.heat_client(self.os_creds)
# This should not throw an exception
- heat.stacks.list()
+ stacks = heat.stacks.list()
+ for stack in stacks:
+ print stack
def test_nova_connect_fail(self):
"""
@@ -52,13 +54,17 @@ class HeatSmokeTests(OSComponentTestCase):
"""
from snaps.openstack.os_credentials import OSCreds
- nova = heat_utils.heat_client(
- OSCreds(username='user', password='pass', auth_url=self.os_creds.auth_url,
- project_name=self.os_creds.project_name, proxy_settings=self.os_creds.proxy_settings))
+ heat = heat_utils.heat_client(
+ OSCreds(username='user', password='pass',
+ auth_url=self.os_creds.auth_url,
+ project_name=self.os_creds.project_name,
+ proxy_settings=self.os_creds.proxy_settings))
+ stacks = heat.stacks.list()
# This should throw an exception
with self.assertRaises(Exception):
- nova.flavors.list()
+ for stack in stacks:
+ print stack
class HeatUtilsCreateStackTests(OSComponentTestCase):
@@ -68,15 +74,16 @@ class HeatUtilsCreateStackTests(OSComponentTestCase):
def setUp(self):
"""
- Instantiates the CreateImage object that is responsible for downloading and creating an OS image file
- within OpenStack
+ Instantiates the CreateImage object that is responsible for downloading
+ and creating an OS image file within OpenStack
"""
guid = self.__class__.__name__ + '-' + str(uuid.uuid4())
stack_name = self.__class__.__name__ + '-' + str(guid) + '-stack'
self.image_creator = OpenStackImage(
self.os_creds, openstack_tests.cirros_image_settings(
- name=self.__class__.__name__ + '-' + str(guid) + '-image', image_metadata=self.image_metadata))
+ name=self.__class__.__name__ + '-' + str(guid) + '-image',
+ image_metadata=self.image_metadata))
self.image_creator.create()
# Create Flavor
@@ -89,7 +96,9 @@ class HeatUtilsCreateStackTests(OSComponentTestCase):
'flavor_name': self.flavor_creator.flavor_settings.name}
heat_tmplt_path = pkg_resources.resource_filename(
'snaps.openstack.tests.heat', 'test_heat_template.yaml')
- self.stack_settings = StackSettings(name=stack_name, template_path=heat_tmplt_path, env_values=env_values)
+ self.stack_settings = StackSettings(
+ name=stack_name, template_path=heat_tmplt_path,
+ env_values=env_values)
self.stack = None
self.heat_client = heat_utils.heat_client(self.os_creds)
@@ -119,12 +128,15 @@ class HeatUtilsCreateStackTests(OSComponentTestCase):
"""
Tests the creation of an OpenStack keypair that does not exist.
"""
- self.stack = heat_utils.create_stack(self.heat_client, self.stack_settings)
+ self.stack = heat_utils.create_stack(self.heat_client,
+ self.stack_settings)
- stack_query_1 = heat_utils.get_stack_by_name(self.heat_client, self.stack_settings.name)
+ stack_query_1 = heat_utils.get_stack_by_name(self.heat_client,
+ self.stack_settings.name)
self.assertEqual(self.stack.id, stack_query_1.id)
- stack_query_2 = heat_utils.get_stack_by_id(self.heat_client, self.stack.id)
+ stack_query_2 = heat_utils.get_stack_by_id(self.heat_client,
+ self.stack.id)
self.assertEqual(self.stack.id, stack_query_2.id)
outputs = heat_utils.get_stack_outputs(self.heat_client, self.stack.id)
@@ -135,7 +147,8 @@ class HeatUtilsCreateStackTests(OSComponentTestCase):
is_active = False
while time.time() < end_time:
- status = heat_utils.get_stack_status(self.heat_client, self.stack.id)
+ status = heat_utils.get_stack_status(self.heat_client,
+ self.stack.id)
if status == create_stack.STATUS_CREATE_COMPLETE:
is_active = True
break