diff --git a/cinder_tempest_plugin/config.py b/cinder_tempest_plugin/config.py index 9cc3573..78dd6ea 100644 --- a/cinder_tempest_plugin/config.py +++ b/cinder_tempest_plugin/config.py @@ -26,11 +26,11 @@ # The barbican service is discovered by config_tempest [1], and will appear # in the [service_available] group in tempest.conf. However, the 'barbican' -# option isn't registered by tempest itself, and so we do it here. This adds -# the ability to test CONF.service_available.barbican. +# option isn't registered by tempest itself, and so we may need to do it. +# This adds the ability to test CONF.service_available.barbican. # # [1] I96800a95f844ce7675d266e456e01620e63e347a -service_available_option = [ +barbican_service_option = [ cfg.BoolOpt('barbican', default=False, help="Whether or not barbican is expected to be available"), diff --git a/cinder_tempest_plugin/plugin.py b/cinder_tempest_plugin/plugin.py index ed8dc2c..5d170e5 100644 --- a/cinder_tempest_plugin/plugin.py +++ b/cinder_tempest_plugin/plugin.py @@ -14,6 +14,7 @@ # under the License. import os +import sys from tempest import config from tempest.test_discover import plugins @@ -46,8 +47,12 @@ config.register_opt_group(conf, config.volume_feature_group, project_config.cinder_option) - config.register_opt_group(conf, config.service_available_group, - project_config.service_available_option) + # Define the 'barbican' service_available option, but only if the + # barbican_tempest_plugin isn't present. It also defines the option, + # and we need to avoid a duplicate option registration. + if 'barbican_tempest_plugin' not in sys.modules: + config.register_opt_group(conf, config.service_available_group, + project_config.barbican_service_option) def get_opt_lists(self): """Get a list of options for sample config generation. @@ -55,8 +60,12 @@ :return: A list of tuples with the group name and options in that group. """ - return [ + opt_lists = [ (config.volume_feature_group.name, project_config.cinder_option), - (config.service_available_group.name, - project_config.service_available_option), ] + + if 'barbican_tempest_plugin' not in sys.modules: + opt_lists.append((config.service_available_group.name, + project_config.barbican_service_option)) + + return opt_lists