Skip Stack Adopt/Abandon integration tests when Stack Adopt is disabled
Closes-Bug: 1415838
Change-Id: I79a8dab72579e9fe1fccb2a67d12cc57d14640ae
diff --git a/common/config.py b/common/config.py
index 31a996b..0ea6263 100644
--- a/common/config.py
+++ b/common/config.py
@@ -88,6 +88,12 @@
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/common/test.py b/common/test.py
index 4c96567..60ed393 100644
--- a/common/test.py
+++ b/common/test.py
@@ -372,6 +372,8 @@
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 @@
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/functional/test_template_resource.py b/functional/test_template_resource.py
index 3b723f8..39855be 100644
--- a/functional/test_template_resource.py
+++ b/functional/test_template_resource.py
@@ -389,7 +389,7 @@
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),