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]
|
[cli]
|
||||||
|
|
||||||
#
|
#
|
||||||
# Options defined in tempest.cli
|
# Options defined in tempest.config
|
||||||
#
|
#
|
||||||
|
|
||||||
# enable cli tests (boolean value)
|
# enable cli tests (boolean value)
|
||||||
|
@ -17,31 +17,15 @@ import os
|
|||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
import tempest.cli.output_parser
|
import tempest.cli.output_parser
|
||||||
|
from tempest import config
|
||||||
from tempest.openstack.common import log as logging
|
from tempest.openstack.common import log as logging
|
||||||
import tempest.test
|
import tempest.test
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
cli_opts = [
|
CONF = config.CONF
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class ClientTestBase(tempest.test.BaseTestCase):
|
class ClientTestBase(tempest.test.BaseTestCase):
|
||||||
@ -50,7 +34,6 @@ class ClientTestBase(tempest.test.BaseTestCase):
|
|||||||
if not CONF.cli.enabled:
|
if not CONF.cli.enabled:
|
||||||
msg = "cli testing disabled"
|
msg = "cli testing disabled"
|
||||||
raise cls.skipException(msg)
|
raise cls.skipException(msg)
|
||||||
cls.identity = cls.config.identity
|
|
||||||
super(ClientTestBase, cls).setUpClass()
|
super(ClientTestBase, cls).setUpClass()
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -106,10 +89,10 @@ class ClientTestBase(tempest.test.BaseTestCase):
|
|||||||
# TODO(jogo) make admin=False work
|
# TODO(jogo) make admin=False work
|
||||||
creds = ('--os-username %s --os-tenant-name %s --os-password %s '
|
creds = ('--os-username %s --os-tenant-name %s --os-password %s '
|
||||||
'--os-auth-url %s ' %
|
'--os-auth-url %s ' %
|
||||||
(self.identity.admin_username,
|
(CONF.identity.admin_username,
|
||||||
self.identity.admin_tenant_name,
|
CONF.identity.admin_tenant_name,
|
||||||
self.identity.admin_password,
|
CONF.identity.admin_password,
|
||||||
self.identity.uri))
|
CONF.identity.uri))
|
||||||
flags = creds + ' ' + flags
|
flags = creds + ' ' + flags
|
||||||
return self.cmd(cmd, action, flags, params, fail_ok)
|
return self.cmd(cmd, action, flags, params, fail_ok)
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ import subprocess
|
|||||||
import tempest.cli
|
import tempest.cli
|
||||||
from tempest import config
|
from tempest import config
|
||||||
|
|
||||||
|
|
||||||
CONF = config.CONF
|
CONF = config.CONF
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -73,14 +72,14 @@ class SimpleReadOnlyCinderClientTest(tempest.cli.ClientTestBase):
|
|||||||
def test_cinder_quota_defaults(self):
|
def test_cinder_quota_defaults(self):
|
||||||
"""This CLI can accept and string as param."""
|
"""This CLI can accept and string as param."""
|
||||||
roles = self.parser.listing(self.cinder('quota-defaults',
|
roles = self.parser.listing(self.cinder('quota-defaults',
|
||||||
params=self.identity.
|
params=CONF.identity.
|
||||||
admin_tenant_name))
|
admin_tenant_name))
|
||||||
self.assertTableStruct(roles, ['Property', 'Value'])
|
self.assertTableStruct(roles, ['Property', 'Value'])
|
||||||
|
|
||||||
def test_cinder_quota_show(self):
|
def test_cinder_quota_show(self):
|
||||||
"""This CLI can accept and string as param."""
|
"""This CLI can accept and string as param."""
|
||||||
roles = self.parser.listing(self.cinder('quota-show',
|
roles = self.parser.listing(self.cinder('quota-show',
|
||||||
params=self.identity.
|
params=CONF.identity.
|
||||||
admin_tenant_name))
|
admin_tenant_name))
|
||||||
self.assertTableStruct(roles, ['Property', 'Value'])
|
self.assertTableStruct(roles, ['Property', 'Value'])
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ class SimpleReadOnlyCinderClientTest(tempest.cli.ClientTestBase):
|
|||||||
self.cinder('list', flags='--retries 3')
|
self.cinder('list', flags='--retries 3')
|
||||||
|
|
||||||
def test_cinder_region_list(self):
|
def test_cinder_region_list(self):
|
||||||
region = self.config.volume.region
|
region = CONF.volume.region
|
||||||
if not region:
|
if not region:
|
||||||
region = self.config.identity.region
|
region = CONF.identity.region
|
||||||
self.cinder('list', flags='--os-region-name ' + region)
|
self.cinder('list', flags='--os-region-name ' + region)
|
||||||
|
@ -16,13 +16,11 @@
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
import tempest.cli
|
import tempest.cli
|
||||||
|
from tempest import config
|
||||||
from tempest.openstack.common import log as logging
|
from tempest.openstack.common import log as logging
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -55,7 +53,7 @@ class SimpleReadOnlyGlanceClientTest(tempest.cli.ClientTestBase):
|
|||||||
'Size', 'Status'])
|
'Size', 'Status'])
|
||||||
|
|
||||||
def test_glance_member_list(self):
|
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',
|
out = self.glance('member-list',
|
||||||
params=tenant_name)
|
params=tenant_name)
|
||||||
endpoints = self.parser.listing(out)
|
endpoints = self.parser.listing(out)
|
||||||
|
@ -14,12 +14,11 @@ import json
|
|||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
import tempest.cli
|
import tempest.cli
|
||||||
|
from tempest import config
|
||||||
from tempest.openstack.common import log as logging
|
from tempest.openstack.common import log as logging
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -16,12 +16,11 @@
|
|||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
|
|
||||||
import tempest.cli
|
import tempest.cli
|
||||||
|
from tempest import config
|
||||||
from tempest.openstack.common import log as logging
|
from tempest.openstack.common import log as logging
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
@ -15,15 +15,14 @@
|
|||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from oslo.config import cfg
|
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
import tempest.cli
|
import tempest.cli
|
||||||
|
from tempest import config
|
||||||
from tempest.openstack.common import log as logging
|
from tempest.openstack.common import log as logging
|
||||||
import tempest.test
|
import tempest.test
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = config.CONF
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -689,6 +689,20 @@ BaremetalGroup = [
|
|||||||
help="Catalog type of the baremetal provisioning service."),
|
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
|
# this should never be called outside of this class
|
||||||
class TempestConfigPrivate(object):
|
class TempestConfigPrivate(object):
|
||||||
@ -759,6 +773,7 @@ class TempestConfigPrivate(object):
|
|||||||
register_opt_group(cfg.CONF, debug_group, DebugGroup)
|
register_opt_group(cfg.CONF, debug_group, DebugGroup)
|
||||||
register_opt_group(cfg.CONF, baremetal_group, BaremetalGroup)
|
register_opt_group(cfg.CONF, baremetal_group, BaremetalGroup)
|
||||||
register_opt_group(cfg.CONF, input_scenario_group, InputScenarioGroup)
|
register_opt_group(cfg.CONF, input_scenario_group, InputScenarioGroup)
|
||||||
|
register_opt_group(cfg.CONF, cli_group, CLIGroup)
|
||||||
self.compute = cfg.CONF.compute
|
self.compute = cfg.CONF.compute
|
||||||
self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
|
self.compute_feature_enabled = cfg.CONF['compute-feature-enabled']
|
||||||
self.identity = cfg.CONF.identity
|
self.identity = cfg.CONF.identity
|
||||||
@ -784,6 +799,7 @@ class TempestConfigPrivate(object):
|
|||||||
self.debug = cfg.CONF.debug
|
self.debug = cfg.CONF.debug
|
||||||
self.baremetal = cfg.CONF.baremetal
|
self.baremetal = cfg.CONF.baremetal
|
||||||
self.input_scenario = cfg.CONF['input-scenario']
|
self.input_scenario = cfg.CONF['input-scenario']
|
||||||
|
self.cli = cfg.CONF.cli
|
||||||
if not self.compute_admin.username:
|
if not self.compute_admin.username:
|
||||||
self.compute_admin.username = self.identity.admin_username
|
self.compute_admin.username = self.identity.admin_username
|
||||||
self.compute_admin.password = self.identity.admin_password
|
self.compute_admin.password = self.identity.admin_password
|
||||||
|
Loading…
Reference in New Issue
Block a user