diff --git a/heat_tempest_plugin/common/test.py b/heat_tempest_plugin/common/test.py index f75385f..a4c0edf 100644 --- a/heat_tempest_plugin/common/test.py +++ b/heat_tempest_plugin/common/test.py @@ -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): diff --git a/heat_tempest_plugin/config.py b/heat_tempest_plugin/config.py index d658a98..e4c7b47 100644 --- a/heat_tempest_plugin/config.py +++ b/heat_tempest_plugin/config.py @@ -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 diff --git a/heat_tempest_plugin/plugin.py b/heat_tempest_plugin/plugin.py index acf4fc7..6926691 100644 --- a/heat_tempest_plugin/plugin.py +++ b/heat_tempest_plugin/plugin.py @@ -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)]