Pass config info in neutron-lbaas api v2 tempest tests

Modify resource_setup to pass on additional
configuration data from tempest.conf to base ServiceClient.
This allows the tests to run when using a modified tempest.conf,
such as a non DevStack environment with a unique region and
endpoint_type specified.

Change-Id: I17ec0566a0bf9d13642e8376af88929c584089f1
Closes-Bug: #1525430
This commit is contained in:
James Arendt 2015-12-09 22:58:41 -08:00
parent ad7072c404
commit a28677983d

View File

@ -37,6 +37,28 @@ if os.path.exists('./tests/tempest/etc/dev_tempest.conf'):
CONF.set_config_path('./tests/tempest/etc/dev_tempest.conf')
def _setup_client_args(auth_provider):
"""Set up ServiceClient arguments using config settings. """
service = CONF.network.catalog_type or 'network'
region = CONF.network.region or 'regionOne'
endpoint_type = CONF.network.endpoint_type
build_interval = CONF.network.build_interval
build_timeout = CONF.network.build_timeout
# The disable_ssl appears in identity
disable_ssl_certificate_validation = (
CONF.identity.disable_ssl_certificate_validation)
ca_certs = None
# Trace in debug section
trace_requests = CONF.debug.trace_requests
return [auth_provider, service, region, endpoint_type,
build_interval, build_timeout,
disable_ssl_certificate_validation, ca_certs,
trace_requests]
class BaseTestCase(base.BaseNetworkTest):
# This class picks non-admin credentials and run the tempest tests
@ -47,12 +69,9 @@ class BaseTestCase(base.BaseNetworkTest):
def resource_setup(cls):
super(BaseTestCase, cls).resource_setup()
# credentials = cls.isolated_creds.get_primary_creds()
# mgr = tempest_clients.Manager(credentials=credentials)
mgr = cls.get_client_manager()
# auth_provider = mgr.get_auth_provider(credentials)
auth_provider = mgr.auth_provider
client_args = [auth_provider, 'network', 'regionOne']
client_args = _setup_client_args(auth_provider)
cls.load_balancers_client = (
load_balancers_client.LoadBalancersClientJSON(*client_args))
@ -344,16 +363,9 @@ class BaseAdminTestCase(BaseTestCase):
super(BaseAdminTestCase, cls).resource_setup()
# credentials = cls.isolated_creds.get_primary_creds()
# mgr = tempest_clients.Manager(credentials=credentials)
mgr = cls.get_client_manager(credential_type='admin')
# auth_provider = mgr.get_auth_provider(credentials)
auth_provider_admin = mgr.auth_provider
# credentials_admin = cls.isolated_creds.get_admin_creds()
# mgr_admin = tempest_clients.Manager(credentials=credentials_admin)
# auth_provider_admin = mgr_admin.get_auth_provider(credentials_admin)
client_args = [auth_provider_admin, 'network', 'regionOne']
client_args = _setup_client_args(auth_provider_admin)
cls.load_balancers_client = (
load_balancers_client.LoadBalancersClientJSON(*client_args))