Commit Graph

45 Commits

Author SHA1 Message Date
Douglas Mendizábal c0ae2d9930 Update tests for admin role in credentials
This patch updates tests to expect "admin" personas to be able to access
credential endpoints.  The relevant policies have been updated in
Keystone.

Change-Id: I54d0ae44a7f669734edcbd31cbc03e9ccf3d829e
2024-04-03 13:50:11 -05:00
Douglas Mendizábal f05f742f80 Fix domain-scope tests for list_domains
A recent change merged in keystone that now allows domain-scoped
tokens to be used to list domains. [1]

This patch changes the tests in the DomainXXXTests classes to expect
the API calls to return without error instead of expecting them to
return 403 - Forbidden.

[1] dd785ee692

Change-Id: I97251f7f2974d3c562e59cc461294d9b040193ed
2024-03-29 09:07:52 -05:00
Douglas Mendizábal b2aa462f0e Consistent and Secure RBAC (Phase 1)
This patch updates the RBAC tests to test the new policy changes in
Keystone that allow users with the "admin" (aka root) role to access
system-level APIs previously available only to the system-admin persona.

The changes affect both the project-admin and domain-admin personas.

All the relevant policy changes have been made in keystone.

Depends-On: https://review.opendev.org/c/openstack/keystone/+/908524
Change-Id: I43c6da5bce9552948692eef8d71408d74382cc4e
2024-02-13 01:45:41 +00:00
Dave Wilde dbe56f0a07 Add existing user logic
There may be a need to run these tests with an existing user.  This
checks the existing user flags and uses that information if they
are true. Defautls to false.

Change-Id: I5dfab4cfa2c55fd133ab7ad2d5235399865794ab
2023-05-02 14:11:49 -05:00
Ade Lee 47a5e98ae9 Add keystone oidc tests
This adds tests to test getting a token (scoped and unscoped) when
keystone is configured to use oidc for authentication.  The oidc
provider is keycloak.  This is based in very large part on Kristi's
work in [1] and [2].

[1] https://github.com/knikolla/devstack-plugin-oidc
[2] https://github.com/CCI-MOC/onboarding-tools

Co-Authored-By: David Wilde <dwilde@redhat.com>
Change-Id: I1772b65f1cc3830ac293a800a79d044a6ab69d65
2023-03-01 11:17:04 +01:00
Douglas Viroel 4eff632695 Replace Identity client endpoint type
This patch replaces Identity client default endpoint type,
which is set to 'adminURL', to use the 'v3_endpoint_type'
from identity configuration.

Related-Bug: #1959930
Change-Id: Iee1fe30420d5ec4721a444e3a10985b31ec23601
Signed-off-by: Douglas Viroel <dviroel@redhat.com>
2022-02-04 14:46:11 -03:00
Zuul f57af91f9a Merge "Replace assertItemsEqual with assertCountEqual" 2022-01-15 15:00:18 +00:00
Lance Bragstad faa9b13891 Increase protection testing for application credentials
This commit updates the application credential protection tests to
ensure users can't craft paths that bypass application credential
ownership checks.

Depends-On: https://review.opendev.org/c/openstack/keystone/+/760972
Change-Id: I7729190d42a6a7199553c5fc058e1b93eecb2068
Related-Bug: 1901207
2021-02-11 16:03:10 +00:00
Colleen Murphy a6d4ceaf57 Add RBAC tests
This change leverages the nine default personas available in tempest[1]
to demonstrate a potential framework for testing default policies. An
abstract base class is created that helps set up credentials and
outlines every policy that needs to be tested, then nine subclasses are
created to test every persona. Each test represents one policy rule, and
some tests make multiple requests in order to test the policy from
different approaches, for example, to check what happens if a different
domain is specified, or what happens if the resource does not exist.

The idea here is to be very verbose and explicit about what is being
tested: every policy gets one test in the base class, and each persona
is tested in a subclass. The layout should be easy to understand and
someone reading the code should not be left guessing whether a case is
missing or if there is magic happening in the background that is causing
a false positive or false negative.

This is intended to replace the unittest protection tests currently
in place.

[1] https://review.opendev.org/686306 (this will require additional
devstack and keystone configuration to work properly in CI)

Depends-on: https://review.opendev.org/686306
Depends-on: https://review.opendev.org/699051
Depends-on: https://review.opendev.org/699519
Depends-on: https://review.opendev.org/700826
Depends-on: https://review.opendev.org/743853
Depends-on: https://review.opendev.org/744087
Depends-on: https://review.opendev.org/744268
Depends-on: https://review.opendev.org/731087

Change-Id: Icb5317b9297230490bd783fe9b07c8db244c06f8
2021-02-11 16:02:54 +00:00
Colleen Murphy 5ee9af871d Add tempest clients for limits
This change adds tempest clients for the registered limits and limits
APIs. While those APIs are experimental, it's best to start development
of the tempest tests in the keystone plugin rather than in tempest. This
base can be used for both developing exhaustive API tests for these APIs
as well as for RBAC tests.

Change-Id: I30b5b2ac5f10fd457e436df876f872432059b655
2020-07-29 16:42:58 -07:00
gugug c2abd827db Replace assertItemsEqual with assertCountEqual
assertItemsEqual was removed from Python's unittest.TestCase in
Python 3.3 [1][2]. We have been able to use them since then, because
testtools required unittest2, which still included it. With testtools
removing Python 2.7 support [3][4], we will lose support for
assertItemsEqual, so we should switch to use assertCountEqual.

[1] - https://bugs.python.org/issue17866
[2] - https://hg.python.org/cpython/rev/d9921cb6e3cd
[3] - testing-cabal/testtools#286
[4] - testing-cabal/testtools#277

Change-Id: I2edc09748de1739c558040a8ae6a15373ad1a93b
2020-07-12 11:25:13 +08:00
Zuul aa17472706 Merge "Add addCleanup just after resource creation" 2020-06-16 15:44:01 +00:00
Vishakha Agarwal da7e045b29 Add addCleanup just after resource creation
This patch follows the sequence of adding addCleanup
just after creating a resource similar to whole
keystone-tempest-plugin repo. This is to avoid the
resource leakage issue if anything happen between
resource creation and addcleanup line.

Change-Id: I258c440417eaecb8f5ed4dc1e0eb6138edda883b
2020-05-15 07:10:23 +00:00
Colleen Murphy 7814dc2034 Use ephemeral test user for k2k tests
Do not use the admin user as a shadowed federated user for the K2K
tests. When trying to add expiring groups for the admin user, keystone
has trouble looking up the user in the cache and fails to add the groups
to the user. This sometimes results in test failures, which may be
masked as failure to clean up the identity provider in between tests and
resulting in a conflict trying to recreate it. This change instead uses
an ephemeral test user rather than the admin user, which is not meant to
be used for authentication tests anyway.

Change-Id: Ia4b53b41a0030772a2abdba949ad7529880d8f70
2020-05-10 22:34:17 -07:00
Vishakha Agarwal b8f6b25ddd Remove func not in use in test_service_providers
This patch removes an unused function _add_cleanup() from
this plugin.

Change-Id: I3647b639618fcebc99a9e7275d80b87b034e2960
2020-05-02 23:48:10 +05:30
Zuul eedd37dc05 Merge "Remove six library" 2020-04-28 23:57:42 +00:00
Colleen Murphy e105e8ce14 Don't test openstack_groups on stable branches
Without this patch, the stable keystone branches fail the K2K tests
because they don't support the assertion feature added in #1687593 and
we don't intend to backport it. This change allows the stable branches
to still be tested using a regular static group mapping.

Change-Id: Ie1be1cc0e961a1584c99247f0c1b0032576718d8
2020-04-21 20:02:37 -07:00
Zuul 7f76adc1b0 Merge "Make checking for singular SPs in list instead of list equality" 2020-04-21 19:21:32 +00:00
Zuul 24ad0ece06 Merge "Test case for openstack_groups" 2020-04-21 17:23:35 +00:00
Vishakha Agarwal 7c365d8f28 Test case for openstack_groups
This patch adds the test case for the adddtion of
"openstack_groups" to the idp assertion.

Depends-on: https://review.opendev.org/#/c/588211/
Change-Id: I5dd932b34a2a8d1013641e08eabfdac84bb4092e
2020-04-07 23:51:53 +05:30
Kristi Nikolla c393015d2d Make checking for singular SPs in list instead of list equality
There is a race condition when the test_service_providers_in_token
test is run at the same time as the k2k test because an extra SP
will appear in the list.

By checking items in the list individually instead of comparing
list equality this should fix the issue.

Change-Id: I13a7a747e108562b326aee1b88485a377530f8a5
2020-04-07 11:54:33 -04:00
Andreas Jaeger a7743599f4 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

The tempest plugin is used on older branches as well.
We really only need hacking on master anyways,
where we no longer support python 2, so here we
make the requirement specific to python 3.

Change-Id: Ia1a3c7cf9f48b30ca800c59078f38f2a22c1a0da
2020-04-04 09:24:58 +02:00
Vishakha Agarwal 9c8933c6bb Remove six library
Change-Id: Iadf31a4d5861cf1e821c6b4473ccec23899a2338
2020-03-23 21:06:29 +05:30
Colleen Murphy 8ec445b13d Add option to disable testing against external idp
Currently, the federation tests are non-voting because they require
connecting to an external service that is not under our control, and is
therefore unreliable. Non-voting tests are a problem because they are
often ignored even when their results are related to new changes. This
change adds a tempest config option
``[identity-feature-enabled]/external_idp``, defaulting to true for
backwards compatibility, which when disabled causes the tests that rely
on the external IdP to be disabled leaving only the K2K federation tests
to be executed. Exercising only the K2K tests is still a good means of
regression testing and we can safely make those tests voting.

Change-Id: I534470df7ca529511ab9a7631f167ec2035ab4be
2019-10-17 11:01:32 -07:00
Kristi Nikolla a9f65e0bcf Keystone to Keystone tests
blueprint devstack-plugin

Depends-On: I55b4e727404d910aa9b5a07b49b783799bc5f098
Change-Id: I6d46b18c75f344b626848adf255b3d459b6b238d
2019-10-16 15:21:41 -07:00
wangxiyuan ddc5109545 Clean up the auto generated domain
During the federation test, when creating an identity provider, a
new domain will be created as well. This auto generated domain
should be cleaned up when test exit.

Depends-on: https://review.openstack.org/#/c/628132/
Change-Id: I6dcd0a0154c8658585a98ae138825881fe51d664
2019-01-03 09:43:29 +00:00
Hemanth Nakkina 6d76b8b929 Add functional test cases for v3-ext/OS-OAUTH1
Add functional test cases for OS-OAUTH1 API
https://developer.openstack.org/api-ref/identity/v3-ext/index.html?expanded=#os-oauth1-api

Change-Id: I8d5921a3b2de273019b075e2ea0e3694344c6912
Depends-On: I4c5369ae3ad7a7add630e3ac6a4fc52f854bc77c
Closes-Bug: #1687593
2017-06-20 12:13:03 +05:30
Luong Anh Tuan b5e6062831 Replace test.attr with decorators.attr
Function 'tempest.test.attr()' has moved to 'tempest.lib.decorators
.attr()' in Pike and will be removed in a future version[1].
This patch replaces the 'tempest.test.attr()' with the 'tempest.lib
.decorators.attr().'

[1] Iaafbb112b6eee458089cc49918359a8a8d0485e2

Change-Id: I52289f8915c05c338b46dce5df7e7d674846916a
2017-05-19 16:20:14 +07:00
Nishant Kumar bdb0adee2e Reuse already existing groups from upstream tempest config
Tempest plugin tests uses the same config file/object from the
upstream tempest, therefore instead of registering the same group
again in plugin tests we should reuse already existing groups and
register only plugin specific option here.

Change-Id: I948fdcf20732b98d5ba5d34fe0352ea9cff59f91
Closes-Bug: #1659596
2017-01-27 01:07:00 -05:00
Davanum Srinivas dc94851b84 Fix issues with keystone-dsvm-py35-functional-v3-only on py35
keystone/token/providers/fernet/token_formatters.py
* decode payload[2] from bytes to string before comparing
  with a string (CONF.identity.default_domain_id)

keystone_tempest_plugin/services/identity/clients.py
keystone_tempest_plugin/services/identity/v3/auth_client.py
keystone_tempest_plugin/services/identity/v3/identity_providers_client.py
* decode the response body from bytes to string before we
  try to parse the json using json.loads

Change-Id: I98053bc498d78c5f0076a66e725ff2d634f5b663
2017-01-05 21:59:57 +00:00
Rodrigo Duarte 3b0cd80734 Fix the usage of tempest.client.Manager class
This should fix our gate. We should continue the work to remove
the dependencies from any module that isn't at tempest.lib.

Change-Id: I2158d1971a4187171a89169c3f324453f0ec13be
2017-01-05 13:07:55 -03:00
Lance Bragstad dedaefd888 Fix import ordering in tempest plugins
For some reason the third-party imports were divided into two
separate groups. This commit combines them to follow the convention
established throughout the rest of the project.

Change-Id: Ice1a681938aef96d0d289a83cadc1cde2f12eb1e
2017-01-02 05:02:11 +00:00
Rodrigo Duarte e508fe0238 Federated authentication via ECP functional tests
Adds a first test for the federated authentication feature. It handles
first the authentication using the SAML2 ECP profile.

The tests cleanup have some issues, see related bug.

Related-Bug: 1642692
Change-Id: I3b393a695c6d9f846efdaf302c1beea34e6bd54b
2016-12-27 09:48:10 -03:00
Ronald De Rose 85c87978c1 Validate mapping exists when creating/updating a protocol
This patch validates that a mapping exists when adding or updating
a federation protocol.

Change-Id: I996f94d26eb0f2c679542ba13a03bbaa4442486a
Closes-Bug: #1571878
2016-10-20 19:12:04 +00:00
Dolph Mathews dd7a774423 Replace keystone.common.config with keystone.conf package
keystone.common.config is 1200+ lines of super dense, merge-conflict
prone, difficult to navigate, and finicky to maintain code. Let's follow
nova's lead and break it down into more manageable modules.

This patch creates a new Python package, keystone.conf, and moves all of
our configuration options into it, mirroring nova's nova.conf package.

There are a couple special modules in keystone.conf introduced here as
well:

- keystone.conf.__init__: This causes all of Keystone options to be
  registered on import, so consumers of keystone.conf don't have
  races with config initialization code while trying to use
  oslo_config.cfg.CONF directly (keystone.conf replaces all uses for
  oslo_config.cfg.CONF in keystone).

- keystone.conf.base: Keystone's [DEFAULT] group options. I'd prefer
  this to be called 'default.py', but I'm just copying nova's lead here.

- keystone.conf.opts: The entry point for oslo.config itself.

- keystone.conf.constants: There are a few constants (deprecation
  messages, default paths, etc) that are used by multiple configuration
  modules, so they need to live in a common place.

Change-Id: Ia3daffe3fef111b42de203762e966cd14d8927e2
2016-06-24 17:02:15 +00:00
Rodrigo Duarte Sousa 79abcf463e Integration tests cleanup
This patch does a cleanup and fixes some nits found by reviewers
in the original patches [1], some of them are:

- import json instead of jsonutils
- use six.moves.http_client
- put common logic on clients superclass
- use "fails" to indicate negative cases
- stronger comparison in update tests

[1] https://review.openstack.org/#/q/topic:federation_integration_tests

Change-Id: I216fc5d4758e7b09d167d9d26271ddd149c66816
2016-06-19 08:27:10 +00:00
Rodrigo Duarte ad9512a490 Add protocols integration tests
This patch adds the tests related to protocols/mappings
in the Identity Provider API (part of the Federated
Identity API)

Change-Id: I5e2573a175edbaf6f7a1bb73f3e0a86deeb94f1d
2016-06-02 16:12:44 -03:00
Rodrigo Duarte 179085d4e8 Add mapping rules integration tests
This patch adds the tests for the Mappings API (part of the
Federated Identity API).

The tests added here are not intended to cover all negative and
corner cases, they are rather testing the API in a higher level
and its integration in a working environment.

Change-Id: If245a12a407f960a7ad5f73aa7af717229976ea2
2016-06-02 16:12:44 -03:00
Rodrigo Duarte d96e29cbe9 Add service providers integration tests
This patch adds the tests for the Service Provider API (part of
the Federated Identity API).

To run the tests install keystone and run (in tempest):

    $ tox -e all-plugin -- keystone

Change-Id: I6d6f44736e4187dd2a500c7c0b6715e52296a9b3
2016-06-02 16:12:43 -03:00
Rodrigo Duarte 8192f6c665 Fix credentials_factory method call
The method has changed from get_configured_credentials to
get_configured_admin_credentials.

This is one of the parts imported directly from tempest
(not tempest.lib) so there is no "care" in keeping it stable.

Change-Id: I0072157d0cf9ab87a5b939868ae4a1d0bbec294b
2016-05-31 10:11:27 -03:00
Jenkins ba555e9cad Merge "Add identity providers integration tests" 2016-05-26 22:17:40 +00:00
Rodrigo Duarte 4666c64163 Add identity providers integration tests
This patch adds a first set of tests in the keystone tempest plugin.
These tests are for the Identity Provider API (part of the Federated
Identity API).

To run the tests install keystone and run (in tempest):

    $ tox -e all-plugin -- keystone

Change-Id: I64ebba2e57aa952a2262f9e0ad143cea7de259c0
2016-05-11 12:44:35 -03:00
OpenStack Proposal Bot 658137d8da Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I9fe9365dd22fad88a778486b31b45c82af62fc8e
2016-04-21 07:06:59 +00:00
OpenStack Proposal Bot bfc93c8980 Imported Translations from Zanata
For more information about this automatic import see:
https://wiki.openstack.org/wiki/Translations/Infrastructure

Change-Id: I4ffdc22ba036fa0be10403cc02bbceee70058409
2016-04-08 06:29:56 +00:00
Rodrigo Duarte 767d01e8ba Base for keystone tempest plugin
This patch adds the basic files and configs in order to enable the
keystone tempest plugin interface using tempest-plugin-cookiecutter.
Since we are adding them inside keystone's repository, they can be
installed alongside keystone and to run the tests (when we have one)
we simply use `testr run keystone_tempest_plugin` in tempest.

For more details about the tempest plugin interface see [1]

[1] http://docs.openstack.org/developer/tempest/plugin.html

Change-Id: Ia42e79246251e8af1010aa8eaf462aacf75644a7
Partially-Implements: bp keystone-tempest-plugin-tests
2016-03-31 11:41:13 -03:00