Add plugin interface for appending to tempest config

This commit adds a new interface to the external plugin interface for
adding configuration options to the config file. This is accomplished
by adding a method to the abstract class which plugins can use for
registering additional opts on the tempest config object. Then on the
tempest side a method is added to the plugin manager class to call the
register function for each plugin. This is then called at the end of
tempest's normal register_opts() function.

Partially Implements: bp external-plugin-interface

Change-Id: I2a7915cd978c496091dcf2cbf9d6a89ecbd8c2aa
Matthew Treinish 2015-07-01 17:37:31 -04:00
parent 7a51877e3c
commit a966d0f83b
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
2 changed files with 21 additions and 0 deletions

View File

@ -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
@ -1184,8 +1186,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
def list_opts():

View File

@ -36,6 +36,17 @@ class TempestPlugin(object):
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.
class TempestTestPluginManager(object):
@ -54,3 +65,7 @@ class TempestTestPluginManager(object):
for plug in self.ext_plugins:
load_tests_dict[] = plug.obj.load_tests()
return load_tests_dict
def register_plugin_opts(self, conf):
for plug in self.ext_plugins: