Commit Graph

10 Commits (db4066912b91d9fed410f6c1da8839700706f837)

Author SHA1 Message Date
Ghanshyam Mann 2d0da049d0 Support scope in dynamic cred for specific roles
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:


Closes-Bug: #1917168
Change-Id: I9053faa255e3680d7f870e3cdedf62fb2eb5cb1a
2 years ago
Sean McGinnis eed8074e64 Use unittest.mock instead of third party mock
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 <>
3 years ago
zhufl 33289a2347 Default to using neutron networks_client in get_tenant_network
Proxy apis to neutron like '/os-networks' are deprecated in
microverion 2.36, and calling to them will get 404 error.
So this is to use neutron networks_client as default in get_tenant_network.

Change-Id: I0496d2d0c3c9fe29d61124275c7f5cca78729bf2
5 years ago
Andrea Frittoli cad70e20cf Don't read config in cred_factory module
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

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
6 years ago
Andrea Frittoli 5fdfc9bfe0 Fix unit test that break isolation
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
6 years ago
Matthew Treinish b19c55df4b
Migrate the preprov creds module to tempest lib
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
6 years ago
Andrea Frittoli (andreaf) 848c4a1488 Stop passing TestResources to Managers
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

Change-Id: I71d4587bf0b640d05d0f78fb84364ce4d2d021f3
Partially-implements: bp client-manager-refactor
7 years ago
Matthew Treinish ffad78a29f
Fix base unit test class location
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

Change-Id: I079eeb1135eed3254e5e9dbebac8a52b979303c7
7 years ago
Jordan Pittier 411290482a Use tempest.tests.lib.base instead of tempest.tests.base
Those 2 files were identical. We should use `tempest.tests.lib.base`
now that we are commited to tempest.lib.
Change-Id: I45d73891f3c0829a2378a032dfc02e5ac0ee34b7
7 years ago
Ryan Rossiter 9228bf7bb0 Allow get_tenant_network() for non-primary creds
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

Change-Id: I1b20259fc4418d722ed4144e156607ec2a667c33
Closes-Bug: #1549381
7 years ago