The watcherclient.plugin Module

The watcherclient.plugin Module

class watcherclient.plugin.WatcherClientTempestPlugin[source]

Bases: tempest.test_discover.plugins.TempestPlugin

get_opt_lists()[source]

Get a list of options for sample config generation

Return option_list:
 A list of tuples with the group name and options in that group.
Return type:list

Example:

# Config options are defined in a config.py module
service_option = cfg.BoolOpt(
    "my_service", default=True,
    help="Whether or not my service is available")

my_service_group = cfg.OptGroup(name="my-service",
                                title="My service options")
my_service_features_group = cfg.OptGroup(
    name="my-service-features",
    title="My service available features")

MyServiceGroup = [<list of options>]
MyServiceFeaturesGroup = [<list of options>]

# Plugin is implemented in a plugin.py module
from my_plugin import config as my_config

def get_opt_lists(self, conf):
    return [
        (my_service_group.name, MyServiceGroup),
        (my_service_features_group.name, MyServiceFeaturesGroup)
    ]
load_tests()[source]

Return the information necessary to load the tests in the plugin.

Returns:a tuple with the first value being the test_dir and the second being the top_level
Return type:tuple
register_opts(conf)[source]

Add additional configuration options to tempest.

This method will be run for the plugin during the register_opts() function in tempest.config.

Parameters:conf (ConfigOpts) – The conf object that can be used to register additional options on.

Example:

# Config options are defined in a config.py module
service_option = cfg.BoolOpt(
    "my_service",
    default=True,
    help="Whether or not my service is available")

# Note: as long as the group is listed in get_opt_lists,
# it will be possible to access its optins in the plugin code
# via ("-" in the group name are replaces with "_"):
#     CONF.my_service.<option_name>
my_service_group = cfg.OptGroup(name="my-service",
                                title="My service options")

MyServiceGroup = [<list of options>]
# (...) More groups and options...

# Plugin is implemented in a plugin.py module
from my_plugin import config as my_config

def register_opts(self, conf):
    conf.register_opt(my_config.service_option,
                      group='service_available')
    conf.register_group(my_config.my_service_group)
    conf.register_opts(my_config.MyServiceGroup,
                       my_config.my_service_group)

    conf.register_group(my_config.my_service_feature_group)
    conf.register_opts(my_config.MyServiceFeaturesGroup,
                       my_config.my_service_feature_group)
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.