Merge "Skip tests based on service features disabled in tempest"

This commit is contained in:
Zuul 2019-03-11 15:06:27 +00:00 committed by Gerrit Code Review
commit 068c170827
2 changed files with 24 additions and 7 deletions

View File

@ -132,19 +132,34 @@ def requires_service_type(service_type):
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

View File

@ -17,11 +17,13 @@ import six
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."""