Execute volume tests only when cinder is available
This change makes sure that the scenario tests which require cinder are
skipped when the [service_available] cinder option is False.
Related-Bug: PRODX-46057
Change-Id: I94c48ecd28acadda39abf4ef794434a72e9a7002
diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py
index 6a5c526..8ac2488 100644
--- a/heat_tempest_plugin/common/test.py
+++ b/heat_tempest_plugin/common/test.py
@@ -109,6 +109,22 @@
return decorator
+def requires_service(service):
+ '''Decorator for tests requiring a specific service being available.
+
+ The decorated test will be skipped when a service is not available. This
+ based on the [service_available] options implemented in tempest
+ '''
+ def decorator(test_method):
+ if not getattr(config.CONF.service_available, service, True):
+ skipper = testtools.skip(
+ "%s service not available, skipping test." % service)
+ return skipper(test_method)
+ else:
+ return test_method
+ return decorator
+
+
def requires_service_type(service_type):
'''Decorator for tests requiring a specific service being available.
@@ -125,7 +141,7 @@
service_type, conf.region, conf.endpoint_type)
except kc_exceptions.EndpointNotFound:
skipper = testtools.skip(
- "%s service not available, skipping test." % service_type)
+ "%s service type not available, skipping test." % service_type)
return skipper(test_method)
else:
return test_method