Migrate the dynamic creds module to tempest lib

This commit migrates the dynamic credentials provider from
tempest/common into tempest/lib.

Change-Id: Id8d60e4d7c22bc72c3e48bc768509ff0cc0c89d5
This commit is contained in:
Matthew Treinish 2017-07-17 12:28:07 -04:00
parent e1e6e7825d
commit c51b712dec
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
8 changed files with 30 additions and 6 deletions

View File

@ -68,3 +68,4 @@ Current Library APIs
library/api_microversion_testing library/api_microversion_testing
library/auth library/auth
library/clients library/clients
library/credential_providers

View File

@ -0,0 +1,16 @@
.. _cred_providers:
Credential Providers
====================
These library interfaces are used to deal with allocating credentials on demand
either dynamically by calling keystone to allocate new credentials, or from
a list of preprovisioned credentials.
------------------------------
The dynamic credentials module
------------------------------
.. automodule:: tempest.lib.common.dynamic_creds
:members:

View File

@ -0,0 +1,5 @@
---
features:
- |
The tempest module tempest.common.dynamic creds which is used for
dynamically allocating credentials has been migrated into tempest lib.

View File

@ -102,8 +102,8 @@ from oslo_log import log as logging
import yaml import yaml
from tempest.common import credentials_factory from tempest.common import credentials_factory
from tempest.common import dynamic_creds
from tempest import config from tempest import config
from tempest.lib.common import dynamic_creds
LOG = None LOG = None

View File

@ -14,10 +14,10 @@
from oslo_concurrency import lockutils from oslo_concurrency import lockutils
from tempest import clients from tempest import clients
from tempest.common import dynamic_creds
from tempest.common import preprov_creds from tempest.common import preprov_creds
from tempest import config from tempest import config
from tempest.lib import auth from tempest.lib import auth
from tempest.lib.common import dynamic_creds
from tempest.lib import exceptions from tempest.lib import exceptions
CONF = config.CONF CONF = config.CONF

View File

@ -140,7 +140,8 @@ class TestGenerateResourcesV2(base.TestCase, MockHelpersMixin):
identity_version = 2 identity_version = 2
cred_client = 'tempest.lib.common.cred_client.V2CredsClient' cred_client = 'tempest.lib.common.cred_client.V2CredsClient'
dynamic_creds = 'tempest.common.dynamic_creds.DynamicCredentialProvider' dynamic_creds = ('tempest.lib.common.dynamic_creds.'
'DynamicCredentialProvider')
def setUp(self): def setUp(self):
super(TestGenerateResourcesV2, self).setUp() super(TestGenerateResourcesV2, self).setUp()
@ -245,7 +246,8 @@ class TestDumpAccountsV2(base.TestCase, MockHelpersMixin):
identity_version = 2 identity_version = 2
cred_client = 'tempest.lib.common.cred_client.V2CredsClient' cred_client = 'tempest.lib.common.cred_client.V2CredsClient'
dynamic_creds = 'tempest.common.dynamic_creds.DynamicCredentialProvider' dynamic_creds = ('tempest.lib.common.dynamic_creds.'
'DynamicCredentialProvider')
domain_is_in = False domain_is_in = False
def setUp(self): def setUp(self):

View File

@ -17,8 +17,8 @@ import mock
from oslo_config import cfg from oslo_config import cfg
from tempest.common import credentials_factory as credentials from tempest.common import credentials_factory as credentials
from tempest.common import dynamic_creds
from tempest import config from tempest import config
from tempest.lib.common import dynamic_creds
from tempest.lib.common import rest_client from tempest.lib.common import rest_client
from tempest.lib import exceptions as lib_exc from tempest.lib import exceptions as lib_exc
from tempest.lib.services.identity.v2 import identity_client as v2_iden_client from tempest.lib.services.identity.v2 import identity_client as v2_iden_client
@ -659,7 +659,7 @@ class TestDynamicCredentialProviderV3(TestDynamicCredentialProvider):
creds = dynamic_creds.DynamicCredentialProvider(**self.fixed_params) creds = dynamic_creds.DynamicCredentialProvider(**self.fixed_params)
creds.creds_client = mock.MagicMock() creds.creds_client = mock.MagicMock()
creds.creds_client.create_user_role.side_effect = lib_exc.Conflict creds.creds_client.create_user_role.side_effect = lib_exc.Conflict
with mock.patch('tempest.common.dynamic_creds.LOG') as log_mock: with mock.patch('tempest.lib.common.dynamic_creds.LOG') as log_mock:
creds._create_creds() creds._create_creds()
log_mock.warning.assert_called_once_with( log_mock.warning.assert_called_once_with(
"Member role already exists, ignoring conflict.") "Member role already exists, ignoring conflict.")