From bc8f8f580bf356dace5fa0a0968f9d179d5e515a Mon Sep 17 00:00:00 2001 From: Taseer Ahmed Date: Fri, 13 Oct 2017 12:34:00 +0500 Subject: Add reason for stack creation failure JIRA: SNAPS-190 Change-Id: I59b7d416ef16cd1f301ccbdcdd8a7529527b3dd6 Signed-off-by: Taseer Ahmed --- snaps/openstack/tests/create_stack_tests.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'snaps/openstack/tests') diff --git a/snaps/openstack/tests/create_stack_tests.py b/snaps/openstack/tests/create_stack_tests.py index d2b138e..f4eb1eb 100644 --- a/snaps/openstack/tests/create_stack_tests.py +++ b/snaps/openstack/tests/create_stack_tests.py @@ -30,7 +30,8 @@ import unittest import uuid from snaps.openstack import create_stack -from snaps.openstack.create_stack import StackSettings, StackSettingsError +from snaps.openstack.create_stack import ( + StackSettings, StackSettingsError, StackCreationError) from snaps.openstack.tests import openstack_tests, create_instance_tests from snaps.openstack.tests.os_source_file_test import OSIntegrationTestCase from snaps.openstack.utils import heat_utils, neutron_utils, nova_utils @@ -214,6 +215,23 @@ class CreateStackSuccessTests(OSIntegrationTestCase): self.assertEqual(created_stack.id, retrieved_stack.id) self.assertEqual(0, len(self.stack_creator.get_outputs())) + def test_create_stack_short_timeout(self): + """ + Tests the creation of an OpenStack stack from Heat template file. + """ + # Create Stack + # Set the default stack settings, then set any custom parameters sent + # from the app + stack_settings = StackSettings( + name=self.__class__.__name__ + '-' + str(self.guid) + '-stack', + template_path=self.heat_tmplt_path, + env_values=self.env_values, stack_create_timeout=0) + + self.stack_creator = create_stack.OpenStackHeatStack(self.heat_creds, + stack_settings) + with self.assertRaises(StackCreationError): + self.stack_creator.create() + def test_create_stack_template_dict(self): """ Tests the creation of an OpenStack stack from a heat dict() object. -- cgit 1.2.3-korg