Convert cli tests to use global CONF object
This commit takes all the uses of config in the cli tests and coverts them to use the global CONF object. Partially implements bp config-cleanup Change-Id: I7a39839d7a4ebbf8372489507486ad2cac7f3adc
This commit is contained in:
parent
6c07229e13
commit
e2b56b5713
@ -155,7 +155,7 @@
|
||||
[cli]
|
||||
|
||||
#
|
||||
# Options defined in tempest.cli
|
||||
# Options defined in tempest.config
|
||||
#
|
||||
|
||||
# enable cli tests (boolean value)
|
||||
|
@ -17,31 +17,15 @@ import os
|
||||
import shlex
|
||||
import subprocess
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import tempest.cli.output_parser
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
import tempest.test
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
cli_opts = [
|
||||
cfg.BoolOpt('enabled',
|
||||
default=True,
|
||||
help="enable cli tests"),
|
||||
cfg.StrOpt('cli_dir',
|
||||
default='/usr/local/bin',
|
||||
help="directory where python client binaries are located"),
|
||||
cfg.IntOpt('timeout',
|
||||
default=15,
|
||||
help="Number of seconds to wait on a CLI timeout"),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
cli_group = cfg.OptGroup(name='cli', title="cli Configuration Options")
|
||||
CONF.register_group(cli_group)
|
||||
CONF.register_opts(cli_opts, group=cli_group)
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class ClientTestBase(tempest.test.BaseTestCase):
|
||||
@ -50,7 +34,6 @@ class ClientTestBase(tempest.test.BaseTestCase):
|
||||
if not CONF.cli.enabled:
|
||||
msg = "cli testing disabled"
|
||||
raise cls.skipException(msg)
|
||||
cls.identity = cls.config.identity
|
||||
super(ClientTestBase, cls).setUpClass()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
@ -106,10 +89,10 @@ class ClientTestBase(tempest.test.BaseTestCase):
|
||||
# TODO(jogo) make admin=False work
|
||||
creds = ('--os-username %s --os-tenant-name %s --os-password %s '
|
||||
'--os-auth-url %s ' %
|
||||
(self.identity.admin_username,
|
||||
self.identity.admin_tenant_name,
|
||||
self.identity.admin_password,
|
||||
self.identity.uri))
|
||||
(CONF.identity.admin_username,
|
||||
CONF.identity.admin_tenant_name,
|
||||
CONF.identity.admin_password,
|
||||
CONF.identity.uri))
|
||||
flags = creds + ' ' + flags
|
||||
return self.cmd(cmd, action, flags, params, fail_ok)
|
||||
|
||||
|
@ -20,7 +20,6 @@ import subprocess
|
||||
import tempest.cli
|
||||
from tempest import config
|
||||
|
||||
|
||||
CONF = config.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -73,14 +72,14 @@ class SimpleReadOnlyCinderClientTest(tempest.cli.ClientTestBase):
|
||||
def test_cinder_quota_defaults(self):
|
||||
"""This CLI can accept and string as param."""
|
||||
roles = self.parser.listing(self.cinder('quota-defaults',
|
||||
params=self.identity.
|
||||
params=CONF.identity.
|
||||
admin_tenant_name))
|
||||
self.assertTableStruct(roles, ['Property', 'Value'])
|
||||
|
||||
def test_cinder_quota_show(self):
|
||||
"""This CLI can accept and string as param."""
|
||||
roles = self.parser.listing(self.cinder('quota-show',
|
||||
params=self.identity.
|
||||
params=CONF.identity.
|
||||
admin_tenant_name))
|
||||
self.assertTableStruct(roles, ['Property', 'Value'])
|
||||
|
||||
@ -146,7 +145,7 @@ class SimpleReadOnlyCinderClientTest(tempest.cli.ClientTestBase):
|
||||
self.cinder('list', flags='--retries 3')
|
||||
|
||||
def test_cinder_region_list(self):
|
||||
region = self.config.volume.region
|
||||
region = CONF.volume.region
|
||||
if not region:
|
||||
region = self.config.identity.region
|
||||
region = CONF.identity.region
|
||||
self.cinder('list', flags='--os-region-name ' + region)
|
||||
|
@ -16,13 +16,11 @@
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import tempest.cli
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
@ -55,7 +53,7 @@ class SimpleReadOnlyGlanceClientTest(tempest.cli.ClientTestBase):
|
||||
'Size', 'Status'])
|
||||
|
||||
def test_glance_member_list(self):
|
||||
tenant_name = '--tenant-id %s' % self.identity.admin_tenant_name
|
||||
tenant_name = '--tenant-id %s' % CONF.identity.admin_tenant_name
|
||||
out = self.glance('member-list',
|
||||
params=tenant_name)
|
||||
endpoints = self.parser.listing(out)
|
||||
|
@ -14,12 +14,11 @@ import json
|
||||
import os
|
||||
import yaml
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import tempest.cli
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF = config.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -16,12 +16,11 @@
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
import tempest.cli
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
|
||||
CONF = cfg.CONF
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
@ -15,15 +15,14 @@
|
||||
|
||||
import subprocess
|
||||
|
||||
from oslo.config import cfg
|
||||
import testtools
|
||||
|
||||
import tempest.cli
|
||||
from tempest import config
|
||||
from tempest.openstack.common import log as logging
|
||||
import tempest.test
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -689,6 +689,20 @@ BaremetalGroup = [
|
||||
help="Catalog type of the baremetal provisioning service."),
|
||||
]
|
||||
|
||||
cli_group = cfg.OptGroup(name='cli', title="cli Configuration Options")
|
||||
|
||||
CLIGroup = [
|
||||
cfg.BoolOpt('enabled',
|
||||
default=True,
|
||||
help="enable cli tests"),
|
||||
cfg.StrOpt('cli_dir',
|
||||
default='/usr/local/bin',
|
||||
help="directory where python client binaries are located"),
|
||||
cfg.IntOpt('timeout',
|
||||
default=15,
|
||||
help="Number of seconds to wait on a CLI timeout"),
|
||||
]
|
||||
|
||||
|
||||
# this should never be called outside of this class
|
||||
class TempestConfigPrivate(object):
|
||||
@ -759,6 +773,7 @@ class TempestConfigPrivate(object):
|
||||
register_opt_group(cfg.CONF, debug_group, DebugGroup)
|
||||
register_opt_group(cfg.CONF, baremetal_group, BaremetalGroup)
|
||||
register_opt_group(cfg.CONF, input_scenario_group, InputScenarioGroup)
|
||||
register_opt_group(cfg.CONF, cli_group, CLIGroup)
|
||||
self.compute = cfg.CONF.compute
|
||||
self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
|
||||
self.identity = cfg.CONF.identity
|
||||
@ -784,6 +799,7 @@ class TempestConfigPrivate(object):
|
||||
self.debug = cfg.CONF.debug
|
||||
self.baremetal = cfg.CONF.baremetal
|
||||
self.input_scenario = cfg.CONF['input-scenario']
|
||||
self.cli = cfg.CONF.cli
|
||||
if not self.compute_admin.username:
|
||||
self.compute_admin.username = self.identity.admin_username
|
||||
self.compute_admin.password = self.identity.admin_password
|
||||
|
Loading…
Reference in New Issue
Block a user