Fix tempest plugin

This code fixes importing configured admin credentials,
adds a help message to 'catalog_type' config parameter
and removes unused custom tempest.conf

Change-Id: I60ba1852d3686141132ae11362f51bf65ddfc618
Closes-bug: #1718669
This commit is contained in:
Mike Fedosin 2017-09-21 21:59:13 +03:00
parent c3939469be
commit 70a559a48a
4 changed files with 13 additions and 112 deletions

View File

@ -14,44 +14,27 @@
# under the License.
from tempest import clients
from tempest.common import credentials_factory as common_creds
from tempest import config
from tempest.lib import auth
from glare_tempest_plugin.services.artifacts import artifacts_client
CONF = config.CONF
ADMIN_CREDS = None
class Manager(object):
def __init__(self,
credentials=common_creds.get_configured_admin_credentials(
'identity_admin')):
self.auth_provider = get_auth_provider(credentials)
class Manager(clients.Manager):
def __init__(self, credentials=None):
if credentials is None:
global ADMIN_CREDS
if ADMIN_CREDS is None:
ADMIN_CREDS = common_creds.get_configured_admin_credentials()
credentials = ADMIN_CREDS
super(Manager, self).__init__(credentials)
self.artifacts_client = artifacts_client.ArtifactsClient(
self.auth_provider)
def get_auth_provider(credentials, scope='project'):
default_params = {
'disable_ssl_certificate_validation':
CONF.identity.disable_ssl_certificate_validation,
'ca_certs': CONF.identity.ca_certificates_file,
'trace_requests': CONF.debug.trace_requests
}
if isinstance(credentials, auth.KeystoneV3Credentials):
auth_provider_class, auth_url = \
auth.KeystoneV3AuthProvider, CONF.identity.uri_v3
else:
auth_provider_class, auth_url = \
auth.KeystoneV2AuthProvider, CONF.identity.uri
_auth_provider = auth_provider_class(credentials, auth_url,
scope=scope,
**default_params)
_auth_provider.set_auth()
return _auth_provider

View File

@ -30,7 +30,8 @@ artifacts_group = cfg.OptGroup(name="artifacts",
ArtifactGroup = [
cfg.StrOpt("catalog_type",
default="artifact"),
default="artifact",
help="Catalog type of Artifacts API"),
cfg.StrOpt("endpoint_type",
default="publicURL",
choices=["publicURL", "adminURL", "internalURL"],

View File

@ -20,8 +20,6 @@ DEVSTACK_PATH="$BASE/new"
(cd $DEVSTACK_PATH/tempest/; sudo pip install -r requirements.txt -r test-requirements.txt)
(cd $DEVSTACK_PATH/; sudo sh -c 'cp -rf glare/glare_tempest_plugin/contrib/tempest.conf /etc/tempest.conf')
sudo cp $DEVSTACK_PATH/tempest/etc/logging.conf.sample $DEVSTACK_PATH/tempest/etc/logging.conf
(cd $DEVSTACK_PATH/glare/; sudo pip install -r requirements.txt -r test-requirements.txt)

View File

@ -1,81 +0,0 @@
# Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
[identity]
# Username to use for Nova API requests. (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
username = admin
# Project name to use for Nova API requests. (string value)
# Deprecated group/name - [DEFAULT]/tenant_name
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
project_name = admin
# Role required to administrate keystone. (string value)
admin_role = admin
# API key to use when authenticating. (string value)
# This option is deprecated for removal.
# Its value may be silently ignored in the future.
password = secretadmin
# The identity region name to use. Also used as the other services'
# region name unless they are set explicitly. If no such region is
# found in the service catalog, the first found one is used. (string
# value)
region = RegionOne
# Identity API version to be used for authentication for API tests.
# (string value)
auth_version = v2
# Full URI of the OpenStack Identity API (Keystone), v2 (string value)
uri = http://127.0.0.1:5000/v2.0/
# Full URI of the OpenStack Identity API (Keystone), v3 (string value)
uri_v3 = http://127.0.0.1:35357/v3/
[auth]
# Allows test cases to create/destroy projects and users. This option
# requires that OpenStack Identity API admin credentials are known. If
# false, isolated test cases and parallel execution, can still be
# achieved configuring a list of test accounts (boolean value)
# Deprecated group/name - [auth]/allow_tenant_isolation
# Deprecated group/name - [compute]/allow_tenant_isolation
# Deprecated group/name - [orchestration]/allow_tenant_isolation
use_dynamic_credentials = true
# Username for an administrative user. This is needed for
# authenticating requests made by project isolation to create users
# and projects (string value)
# Deprecated group/name - [identity]/admin_username
admin_username = admin
# Project name to use for an administrative user. This is needed for
# authenticating requests made by project isolation to create users
# and projects (string value)
# Deprecated group/name - [auth]/admin_tenant_name
# Deprecated group/name - [identity]/admin_tenant_name
admin_project_name = admin
# Password to use for an administrative user. This is needed for
# authenticating requests made by project isolation to create users
# and projects (string value)
# Deprecated group/name - [identity]/admin_password
admin_password = secretadmin