Adapt plugin to use new tempest stable interface

This change uses a new tempest interface in the plugin
to automatically register service clients[0]. It also changes
the plugin to use in-tree data processing client which was
recently imported from tempest.

[0]
http://lists.openstack.org/pipermail/openstack-dev/2016-August/101552.html

Change-Id: Ie2b30868408687d090cff0a8743d9ddc125a96a0
This commit is contained in:
Raissa Sarmento 2016-08-29 09:21:33 -03:00
parent c7ccde2a68
commit 6a2b026547
7 changed files with 81 additions and 20 deletions

View File

@ -0,0 +1,8 @@
---
prelude: >
Sahara Tests plugin now uses tempest stable interface
other:
- Sahara Tests plugin is adapted to use in-tree client,
which was migrated from Tempest code. Also, there's a
new stable interface for Service Clients in Tempest, so
this change adapts the code to use it.

View File

@ -22,6 +22,6 @@ python-swiftclient>=2.2.0 # Apache-2.0
python-neutronclient>=4.2.0 # Apache-2.0
rfc3986>=0.2.0 # Apache-2.0
six>=1.9.0 # MIT
tempest>=11.0.0 # Apache-2.0
tempest>=12.2.0 # Apache-2.0
testrepository>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT

View File

@ -0,0 +1,30 @@
# Copyright 2016 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
from tempest import config
from tempest.lib.services import clients
CONF = config.CONF
class Manager(clients.ServiceClients):
"""Tempest stable service clients and loaded plugins service clients"""
def __init__(self, credentials, service=None):
if CONF.identity.auth_version == 'v2':
identity_uri = CONF.identity.uri
else:
identity_uri = CONF.identity.uri_v3
super(Manager, self).__init__(credentials, identity_uri)

View File

@ -67,3 +67,23 @@ class SaharaTempestPlugin(plugins.TempestPlugin):
(sahara_config.service_available_group.name,
sahara_config.ServiceAvailableGroup)
]
def get_service_clients(self):
# Ignore the ArgsAlreadyParsed error: it means that
# the same content is (still) defined in Tempest
try:
data_processing_config = (
config.service_client_config('data-processing'))
except cfg.ArgsAlreadyParsedError:
# the service name must be returned with the other params
data_processing_config = {'service': 'data-processing'}
params = {
'name': 'data_processing',
'service_version': 'data_processing.v1_1',
'module_path':
'sahara_tempest_plugin.services.data_processing.v1_1',
'client_names': ['DataProcessingClient']
}
params.update(data_processing_config)
return [params]

View File

@ -1,18 +0,0 @@
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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.
from tempest.services.data_processing.v1_1.data_processing_client import \
DataProcessingClient
__all__ = ['DataProcessingClient']

View File

@ -0,0 +1,18 @@
# Copyright (c) 2016 Hewlett-Packard Enterprise Development Company, L.P.
#
# 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.
from sahara_tempest_plugin.services.data_processing.v1_1.data_processing_client import \
DataProcessingClient
__all__ = ['DataProcessingClient']

View File

@ -22,6 +22,7 @@ from tempest import exceptions
from tempest.lib import exceptions as lib_exc
import tempest.test
from sahara_tempest_plugin import clients
CONF = config.CONF
@ -190,6 +191,8 @@ class BaseDataProcessingTest(tempest.test.BaseTestCase):
credentials = ['primary']
client_manager = clients.Manager
@classmethod
def skip_checks(cls):
super(BaseDataProcessingTest, cls).skip_checks()
@ -200,7 +203,7 @@ class BaseDataProcessingTest(tempest.test.BaseTestCase):
@classmethod
def setup_clients(cls):
super(BaseDataProcessingTest, cls).setup_clients()
cls.client = cls.os.data_processing_client
cls.client = cls.os.data_processing.DataProcessingClient()
@classmethod
def resource_setup(cls):