Merge "Add feature flags in config to enable tests conditionally"

This commit is contained in:
Zuul 2018-03-26 23:02:34 +00:00 committed by Gerrit Code Review
commit 4b8e75f065
3 changed files with 32 additions and 1 deletions

View File

@ -110,6 +110,22 @@ def requires_resource_type(resource_type):
return decorator
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 decorator
class HeatIntegrationTest(testtools.testcase.WithAttributes,
testscenarios.WithScenarios,
testtools.TestCase):

View File

@ -156,7 +156,18 @@ HeatGroup = [
]
heat_features_group = cfg.OptGroup(
name='heat_features_enabled',
title="Enabled Orchestration Service Features")
HeatFeaturesGroup = [
cfg.BoolOpt('stack_cancel',
default=False,
help="If false, skip stack cancel tests")
]
def list_opts():
yield heat_group.name, HeatGroup
yield heat_features_group.name, HeatFeaturesGroup
yield service_available_group.name, ServiceAvailableGroup

View File

@ -34,7 +34,11 @@ class HeatTempestPlugin(plugins.TempestPlugin):
heat_config.ServiceAvailableGroup)
config.register_opt_group(conf, heat_config.heat_group,
heat_config.HeatGroup)
config.register_opt_group(conf, heat_config.heat_features_group,
heat_config.HeatFeaturesGroup)
def get_opt_lists(self):
return [(heat_config.heat_group.name,
heat_config.HeatGroup)]
heat_config.HeatGroup),
(heat_config.heat_features_group.name,
heat_config.HeatFeaturesGroup)]