Merge "Add plugin interface for appending to tempest config"
commit
91a9548c14
|
@ -22,6 +22,8 @@ from oslo_config import cfg
|
|||
|
||||
from oslo_log import log as logging
|
||||
|
||||
from tempest.test_discover import plugins
|
||||
|
||||
|
||||
# TODO(marun) Replace use of oslo_config's global ConfigOpts
|
||||
# (cfg.CONF) instance with a local instance (cfg.ConfigOpts()) once
|
||||
|
@ -1192,8 +1194,12 @@ _opts = [
|
|||
|
||||
|
||||
def register_opts():
|
||||
ext_plugins = plugins.TempestTestPluginManager()
|
||||
# Register in-tree tempest config options
|
||||
for g, o in _opts:
|
||||
register_opt_group(_CONF, g, o)
|
||||
# Call external plugin config option registration
|
||||
ext_plugins.register_plugin_opts(_CONF)
|
||||
|
||||
|
||||
def list_opts():
|
||||
|
|
|
@ -40,6 +40,17 @@ class TempestPlugin(object):
|
|||
"""
|
||||
return
|
||||
|
||||
@abc.abstractmethod
|
||||
def register_opts(self, conf):
|
||||
"""Method to add additional configuration options to tempest. This
|
||||
method will be run for the plugin during the register_opts() function
|
||||
in tempest.config
|
||||
|
||||
:param ConfigOpts conf: The conf object that can be used to register
|
||||
additional options on.
|
||||
"""
|
||||
return
|
||||
|
||||
|
||||
@misc.singleton
|
||||
class TempestTestPluginManager(object):
|
||||
|
@ -64,3 +75,7 @@ class TempestTestPluginManager(object):
|
|||
for plug in self.ext_plugins:
|
||||
load_tests_dict[plug.name] = plug.obj.load_tests()
|
||||
return load_tests_dict
|
||||
|
||||
def register_plugin_opts(self, conf):
|
||||
for plug in self.ext_plugins:
|
||||
plug.obj.register_opts(conf)
|
||||
|
|
Loading…
Reference in New Issue