diff --git a/doc/source/library.rst b/doc/source/library.rst index 29248d16f2..a461a0fc00 100644 --- a/doc/source/library.rst +++ b/doc/source/library.rst @@ -68,3 +68,4 @@ Current Library APIs library/api_microversion_testing library/auth library/clients + library/credential_providers diff --git a/doc/source/library/credential_providers.rst b/doc/source/library/credential_providers.rst new file mode 100644 index 0000000000..fea20bfb13 --- /dev/null +++ b/doc/source/library/credential_providers.rst @@ -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: diff --git a/releasenotes/notes/migrate-dynamic-creds-ecebb47528080761.yaml b/releasenotes/notes/migrate-dynamic-creds-ecebb47528080761.yaml new file mode 100644 index 0000000000..c20cbc68d7 --- /dev/null +++ b/releasenotes/notes/migrate-dynamic-creds-ecebb47528080761.yaml @@ -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. diff --git a/tempest/cmd/account_generator.py b/tempest/cmd/account_generator.py index a76123cdc8..8636405b45 100755 --- a/tempest/cmd/account_generator.py +++ b/tempest/cmd/account_generator.py @@ -102,8 +102,8 @@ from oslo_log import log as logging import yaml from tempest.common import credentials_factory -from tempest.common import dynamic_creds from tempest import config +from tempest.lib.common import dynamic_creds LOG = None diff --git a/tempest/common/credentials_factory.py b/tempest/common/credentials_factory.py index 449c343896..d96338be12 100644 --- a/tempest/common/credentials_factory.py +++ b/tempest/common/credentials_factory.py @@ -14,10 +14,10 @@ from oslo_concurrency import lockutils from tempest import clients -from tempest.common import dynamic_creds from tempest.common import preprov_creds from tempest import config from tempest.lib import auth +from tempest.lib.common import dynamic_creds from tempest.lib import exceptions CONF = config.CONF diff --git a/tempest/common/dynamic_creds.py b/tempest/lib/common/dynamic_creds.py similarity index 100% rename from tempest/common/dynamic_creds.py rename to tempest/lib/common/dynamic_creds.py diff --git a/tempest/tests/cmd/test_account_generator.py b/tempest/tests/cmd/test_account_generator.py index 248cfb0e9e..f907bd0814 100644 --- a/tempest/tests/cmd/test_account_generator.py +++ b/tempest/tests/cmd/test_account_generator.py @@ -140,7 +140,8 @@ class TestGenerateResourcesV2(base.TestCase, MockHelpersMixin): identity_version = 2 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): super(TestGenerateResourcesV2, self).setUp() @@ -245,7 +246,8 @@ class TestDumpAccountsV2(base.TestCase, MockHelpersMixin): identity_version = 2 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 def setUp(self): diff --git a/tempest/tests/common/test_dynamic_creds.py b/tempest/tests/lib/common/test_dynamic_creds.py similarity index 99% rename from tempest/tests/common/test_dynamic_creds.py rename to tempest/tests/lib/common/test_dynamic_creds.py index cf131eb79a..6aa7a42707 100644 --- a/tempest/tests/common/test_dynamic_creds.py +++ b/tempest/tests/lib/common/test_dynamic_creds.py @@ -17,8 +17,8 @@ import mock from oslo_config import cfg from tempest.common import credentials_factory as credentials -from tempest.common import dynamic_creds from tempest import config +from tempest.lib.common import dynamic_creds from tempest.lib.common import rest_client from tempest.lib import exceptions as lib_exc 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.creds_client = mock.MagicMock() 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() log_mock.warning.assert_called_once_with( "Member role already exists, ignoring conflict.")