From 66c1447860e2becf01dd9511a712e17fcdd16cb1 Mon Sep 17 00:00:00 2001 From: Sirushti Murugesan Date: Mon, 2 Feb 2015 23:00:23 +0530 Subject: [PATCH] Skip Stack Adopt/Abandon integration tests when Stack Adopt is disabled Closes-Bug: 1415838 Change-Id: I79a8dab72579e9fe1fccb2a67d12cc57d14640ae --- heat_integrationtests/common/config.py | 6 ++++++ heat_integrationtests/common/test.py | 9 +++++++++ .../functional/test_template_resource.py | 2 +- heat_integrationtests/heat_integrationtests.conf.sample | 6 ++++++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/heat_integrationtests/common/config.py b/heat_integrationtests/common/config.py index 31a996b42..0ea626377 100644 --- a/heat_integrationtests/common/config.py +++ b/heat_integrationtests/common/config.py @@ -88,6 +88,12 @@ IntegrationTestGroup = [ cfg.IntOpt('volume_size', default=1, help='Default size in GB for volumes created by volumes tests'), + cfg.BoolOpt('skip_stack_adopt_tests', + default=False, + help="Skip Stack Adopt Integration tests"), + cfg.BoolOpt('skip_stack_abandon_tests', + default=False, + help="Skip Stack Abandon Integration tests"), ] diff --git a/heat_integrationtests/common/test.py b/heat_integrationtests/common/test.py index 4c9656737..60ed3938e 100644 --- a/heat_integrationtests/common/test.py +++ b/heat_integrationtests/common/test.py @@ -372,6 +372,8 @@ class HeatIntegrationTest(testscenarios.WithScenarios, def stack_adopt(self, stack_name=None, files=None, parameters=None, environment=None, adopt_data=None, wait_for_status='ADOPT_COMPLETE'): + if self.conf.skip_stack_adopt_tests: + self.skipTest('Testing Stack adopt disabled in conf, skipping') name = stack_name or self._stack_rand_name() templ_files = files or {} params = parameters or {} @@ -390,3 +392,10 @@ class HeatIntegrationTest(testscenarios.WithScenarios, stack_identifier = '%s/%s' % (name, stack.id) self._wait_for_stack_status(stack_identifier, wait_for_status) return stack_identifier + + def stack_abandon(self, stack_id): + if self.conf.skip_stack_abandon_tests: + self.addCleanup(self.client.stacks.delete, stack_id) + self.skipTest('Testing Stack abandon disabled in conf, skipping') + info = self.client.stacks.abandon(stack_id=stack_id) + return info diff --git a/heat_integrationtests/functional/test_template_resource.py b/heat_integrationtests/functional/test_template_resource.py index 3b723f8c0..39855be0e 100644 --- a/heat_integrationtests/functional/test_template_resource.py +++ b/heat_integrationtests/functional/test_template_resource.py @@ -389,7 +389,7 @@ Outputs: stack_identifier = '%s/%s' % (stack_name, stack.id) self._wait_for_stack_status(stack_identifier, 'CREATE_COMPLETE') - info = self.client.stacks.abandon(stack_id=stack_identifier) + info = self.stack_abandon(stack_id=stack_identifier) self.assertEqual(self._yaml_to_json(self.main_template), info['template']) self.assertEqual(self._yaml_to_json(self.nested_templ), diff --git a/heat_integrationtests/heat_integrationtests.conf.sample b/heat_integrationtests/heat_integrationtests.conf.sample index 2dbdaf6a8..de3bf24ca 100644 --- a/heat_integrationtests/heat_integrationtests.conf.sample +++ b/heat_integrationtests/heat_integrationtests.conf.sample @@ -69,3 +69,9 @@ # Default size in GB for volumes created by volumes tests (integer value) #volume_size = 1 + +# Skip Stack Adopt Integration tests (boolean value) +#skip_stack_adopt_tests = false + +# Skip Stack Abandon Integration tests (boolean value) +#skip_stack_abandon_tests = false