Allow to change the version of API also for CLI tests

The tempest.conf configuration key data-processing.saharaclient.version
was renamed to api_version_saharaclient; the old name is still accepted.
More important, the variable controls also the version of the API
used for CLI tests, not only for tempest.lib-based client tests.

The signature of ClientTestBase.openstack changes a bit (no more *args
and **kwargs) but it should not cause any regression, because the
method only passes the parameters to the corresponding function
from tempest.lib.cli, which accepts that specific set of arguments.

Change-Id: I2034591f9f336100b2eb3c0e42e4b94227c90625
This commit is contained in:
Luigi Toscano 2018-07-24 18:24:57 +02:00
parent 59e264fa1a
commit ef9c4bf454
4 changed files with 21 additions and 5 deletions

View File

@ -0,0 +1,10 @@
---
features:
- |
The ``api_version_saharaclient`` variable now controls the Sahara API
version used not only by the Tempest.lib-based clients tests,
but also by the Tempest CLI tests.
deprecations:
- |
The ``saharaclient_version`` option in the ``data-processing`` group
has been renamed to ``api_version_saharaclient``.

View File

@ -51,9 +51,10 @@ DataProcessingAdditionalGroup = [
cfg.StrOpt('test_ssh_user',
default='ubuntu',
help='username used to access the test image.'),
cfg.StrOpt('saharaclient_version',
cfg.StrOpt('api_version_saharaclient',
default='1.1',
help='Version of python-saharaclient'),
help='Version of Sahara API used by saharaclient',
deprecated_name='saharaclient_version'),
cfg.StrOpt('sahara_url',
help='Sahara url as http://ip:port/api_version/tenant_id'),
# TODO(shuyingya): Delete this option once the Mitaka release is EOL.

View File

@ -77,8 +77,13 @@ class ClientTestBase(base.ClientTestBase):
'project_domain_name'),
identity_api_version=identity_api_version)
def openstack(self, *args, **kwargs):
return self.clients.openstack(*args, **kwargs)
def openstack(self, action, flags='', params='', fail_ok=False,
merge_stderr=False):
if '--os-data-processing-api-version' not in flags:
flags = flags + '--os-data-processing-api-version %s' % \
(TEMPEST_CONF.data_processing.api_version_saharaclient)
return self.clients.openstack(action, flags=flags, params=params,
fail_ok=fail_ok, merge_stderr=False)
def listing_result(self, command):
command_for_item = self.openstack('dataprocessing', params=command)

View File

@ -60,7 +60,7 @@ class BaseDataProcessingTest(tempest.test.BaseTestCase):
ses = session.Session(auth=auth)
cls.client = sahara_client.Client(
TEMPEST_CONF.data_processing.saharaclient_version,
TEMPEST_CONF.data_processing.api_version_saharaclient,
session=ses,
service_type=catalog_type,
endpoint_type=endpoint_type)