We already added scope support for 'admin', 'member',
and 'reader' role. This commit is to adds the scope
support for specific roles, basically in get_creds_by_roles().
Test can now request the scope along with the number of roles
using the scope as prefix in credential type. Fpr example:
credentials = [['my_role', 'role1'], # this will be old style and project scoped
['project_my_role', 'role1'], # this will be project scoped
['domain_my_role', 'role1'], # this will be domain scoped
['system_my_role', 'role1']] # this will be system scoped
and below is how test can access the credential manager of respective
credentials type:
cls.os_my_role.any_client
cls.os_project_my_role.any_client
cls.os_domain_my_role.any_client
cls.os_system_my_role.any_client
Closes-Bug: #1917168
Change-Id: I9053faa255e3680d7f870e3cdedf62fb2eb5cb1a
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Change-Id: If1de2f48da1fd6ed3f96c98b8dce9eace4f8095d
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The credentials_factory module loads a few bit configuration
at module import time when the DEFAULT_PARAMS variable is defined.
This is not a good idea as it forces configuration to be loaded
even during test discovery. Besides DEFAULT_PARAMS was out of
date as it did not include http_timeout.
Replacing the DEFAULT_PARAMS variable with calls to
config.service_client_config().
Not loading CONF at test discovery time uncovered the fact that
the account generator unit tests were depending on oslo log
configuration parameters to be there. Mocking the log setup
step fixed the issue.
Change-Id: I6e0eb85b3749baedb6035f59ed1c66850f6c95fb
Unit test that require configuration should use the configuration
fixture and set_default so that configuration changes stay isolated
to the specific test.
Tests in test_base_test break this rule and cause race conditions
in other tests, fixing that.
Change-Id: I1c0b62cb29268fb4d34ab769eaf35139c4204509
This commit migrates the preprovisioned credentials provider from
tempest/common into tempest/lib. As part of this 2 dependencies are
also migrated to lib: the InvalidTestResource exception class and the
tempest.common.fixed_network module.
Change-Id: Ib9e909aaaf81f7cb57e2382cec44598e918747b8
Dynamic credential providers generate TestResource objects, which
behave like Credentials but also include network resources.
We used to pass those directly into client managers, but that has
several issues: the interface of the client manager is confusing,
because it accepts two different type of objects in one parameter.
Having the client manager depending on the dynamic credential provider
is a problem because in turn that depends on the client manager,
which may lead to circular dependencies when trying to make those
stable interfaces for tempest.lib.
Finally TestResources seem to confused developers, since a number of tests
ignored the possibility of getting Credential fields from TestResources
directly, and went through the inner credentials atttribute.
I think the best approach for now is to pass auth.Credentials objects
only into the client manager. The client manager does not use the
network resources anyways.
We plan to refactor the link between credential provider and network
resources anyways, so it's better to have that outside of client
managers.
Change-Id: I71d4587bf0b640d05d0f78fb84364ce4d2d021f3
Partially-implements: bp client-manager-refactor
The recent commit I45d73891f3c0829a2378a032dfc02e5ac0ee34b7
deduplicated the base test class methods from the tempest.lib
reintegration. However the surviving base class was put in the wrong
namespace. The base class is just that a base to build the individual
test subclass off of. It's very confusing for that to not live in the
base tests namespace. While the code in lib is supposed to be self
contained there isn't a reason to do that here for the unit tests,
especially because in this case the import heiarchy becomes more
confusing with the base living in a submodule. This commit moves the
base class to the base tempest.tests namespace where it really
belongs.
Change-Id: I079eeb1135eed3254e5e9dbebac8a52b979303c7
Those 2 files were identical. We should use `tempest.tests.lib.base`
now that we are commited to tempest.lib.
Change-Id: I45d73891f3c0829a2378a032dfc02e5ac0ee34b7
Within get_tenant_network(), a client manager was always retrieved, but
because no arguments were passed, it always retrieved the client manager
for the primary credentials. The credentials for the tenant network to
retrieve needs to be passed in so the appropriate client manager can be
retrieved.
Change-Id: I1b20259fc4418d722ed4144e156607ec2a667c33
Closes-Bug: #1549381