From 287f9ec7caa42ebd44a2bf304d16019bd01cac5a Mon Sep 17 00:00:00 2001 From: Nishant Kumar Date: Fri, 23 Sep 2016 20:11:58 +0530 Subject: [PATCH] Reuse already existing groups in tempest plugin Instead of registering new groups we can reuse already registered groups in tempest/config.py. Changes should be made to the following groups: a) service_available_group - We don't need this group in plugin code because it is already being registered in tempest code and service availability is being checked for in the /tempest/api/volume/base.py and the test cases in plugin code inherits this base.py b) cinder group - Instead of registering a new cinder group for plugin tests we can add plugin specific configuration options in the existing volume group as the same conf object from tempest is being passed on to the plugin Change-Id: Ie0ca52ec389c581ca47db3e9bbb0793a2bb47fdf Closes-Bug: #1626575 --- .../api/volume/test_consistencygroups.py | 2 +- cinder/tests/tempest/config.py | 17 +---------------- cinder/tests/tempest/plugin.py | 13 ++++--------- 3 files changed, 6 insertions(+), 26 deletions(-) diff --git a/cinder/tests/tempest/api/volume/test_consistencygroups.py b/cinder/tests/tempest/api/volume/test_consistencygroups.py index 44c9938..c9850f0 100644 --- a/cinder/tests/tempest/api/volume/test_consistencygroups.py +++ b/cinder/tests/tempest/api/volume/test_consistencygroups.py @@ -38,7 +38,7 @@ class ConsistencyGroupsV2Test(base.BaseVolumeAdminTest): @classmethod def skip_checks(cls): super(ConsistencyGroupsV2Test, cls).skip_checks() - if not CONF.cinder.consistency_group: + if not CONF.volume_feature_enabled.consistency_group: raise cls.skipException("Cinder consistency group " "feature disabled") diff --git a/cinder/tests/tempest/config.py b/cinder/tests/tempest/config.py index d1a2db7..f4eb098 100644 --- a/cinder/tests/tempest/config.py +++ b/cinder/tests/tempest/config.py @@ -15,22 +15,7 @@ from oslo_config import cfg -service_available_group = cfg.OptGroup(name="service_available", - title="Available OpenStack Services") - - -ServiceAvailableGroup = [ - cfg.BoolOpt("cinder", - default=True, - help="Whether or not cinder is expected to be available"), -] - -# Use a new config group specific to the cinder in-tree tests to avoid -# any naming confusion with the upstream tempest config options. -cinder_group = cfg.OptGroup(name='cinder', - title='Cinder Tempest Config Options') - -CinderGroup = [ +cinder_option = [ cfg.BoolOpt('consistency_group', default=False, help='Enable to run Cinder volume consistency group tests'), diff --git a/cinder/tests/tempest/plugin.py b/cinder/tests/tempest/plugin.py index ed7a912..b816963 100644 --- a/cinder/tests/tempest/plugin.py +++ b/cinder/tests/tempest/plugin.py @@ -32,17 +32,12 @@ class CinderTempestPlugin(plugins.TempestPlugin): def register_opts(self, conf): config.register_opt_group( - conf, project_config.service_available_group, - project_config.ServiceAvailableGroup) - config.register_opt_group( - conf, project_config.cinder_group, - project_config.CinderGroup + conf, config.volume_feature_group, + project_config.cinder_option ) def get_opt_lists(self): return [ - (project_config.service_available_group.name, - project_config.ServiceAvailableGroup), - (project_config.cinder_group.name, - project_config.CinderGroup), + (config.volume_feature_group.name, + project_config.cinder_option), ]