Merge "Skip tests based on service features disabled in tempest"
diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py
index ccbc12a..008ac87 100644
--- a/heat_tempest_plugin/common/test.py
+++ b/heat_tempest_plugin/common/test.py
@@ -132,19 +132,34 @@
return decorator
+def _check_require(group, feature, test_method):
+ features_group = getattr(config.CONF, group, None)
+ if not features_group:
+ return test_method
+ feature_enabled = features_group.get(feature, True)
+ skipper = testtools.skipUnless(feature_enabled,
+ "%s - Feature not enabled." % feature)
+ return skipper(test_method)
+
+
def requires_feature(feature):
'''Decorator for tests requring specific feature.
The decorated test will be skipped when a specific feature is disabled.
'''
def decorator(test_method):
- features_group = getattr(config.CONF, 'heat_features_enabled', None)
- if not features_group:
- return test_method
- feature_enabled = config.CONF.heat_features_enabled.get(feature, False)
- skipper = testtools.skipUnless(feature_enabled,
- "%s - Feature not enabled." % feature)
- return skipper(test_method)
+ return _check_require('heat_features_enabled', feature, test_method)
+ return decorator
+
+
+def requires_service_feature(service, feature):
+ '''Decorator for tests requring specific service feature enabled in tempest.
+
+ The decorated test will be skipped when a specific feature is disabled.
+ '''
+ def decorator(test_method):
+ group = service + '_feature_enabled'
+ return _check_require(group, feature, test_method)
return decorator
diff --git a/heat_tempest_plugin/tests/scenario/test_volumes.py b/heat_tempest_plugin/tests/scenario/test_volumes.py
index 57d0936..7dfa8bf 100644
--- a/heat_tempest_plugin/tests/scenario/test_volumes.py
+++ b/heat_tempest_plugin/tests/scenario/test_volumes.py
@@ -17,11 +17,13 @@
from tempest.lib import decorators
from heat_tempest_plugin.common import exceptions
+from heat_tempest_plugin.common import test
from heat_tempest_plugin.tests.scenario import scenario_base
LOG = logging.getLogger(__name__)
+@test.requires_service_feature('volume', 'backup')
class VolumeBackupRestoreIntegrationTest(scenario_base.ScenarioTestsBase):
"""Class is responsible for testing of volume backup."""