Matthew Treinish | bc1b15b | 2015-02-20 15:56:07 -0500 | [diff] [blame] | 1 | Tempest Configuration Guide |
| 2 | =========================== |
| 3 | |
| 4 | Auth/Credentials |
| 5 | ---------------- |
| 6 | |
| 7 | Tempest currently has 2 different ways in configuration to provide credentials |
| 8 | to use when running tempest. One is a traditional set of configuration options |
| 9 | in the tempest.conf file. These options are in the identity section and let you |
| 10 | specify a regular user, a global admin user, and a alternate user set of |
| 11 | credentials. (which consist of a username, password, and project/tenant name) |
| 12 | These options should be clearly labelled in the sample config file in the |
| 13 | identity section. |
| 14 | |
| 15 | The other method to provide credentials is using the accounts.yaml file. This |
| 16 | file is used to specify an arbitrary number of users available to run tests |
| 17 | with. You can specify the location of the file in the |
| 18 | auth section in the tempest.conf file. To see the specific format used in |
| 19 | the file please refer to the accounts.yaml.sample file included in tempest. |
| 20 | Currently users that are specified in the accounts.yaml file are assumed to |
| 21 | have the same set of roles which can be used for executing all the tests you |
| 22 | are running. This will be addressed in the future, but is a current limitation. |
| 23 | Eventually the config options for providing credentials to tempest will be |
| 24 | deprecated and removed in favor of the accounts.yaml file. |
| 25 | |
| 26 | Credential Provider Mechanisms |
| 27 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 28 | |
| 29 | Tempest currently also has 3 different internal methods for providing |
| 30 | authentication to tests. Tenant isolation, locking test accounts, and |
| 31 | non-locking test accounts. Depending on which one is in use the configuration |
| 32 | of tempest is slightly different. |
| 33 | |
| 34 | Tenant Isolation |
| 35 | """""""""""""""" |
| 36 | Tenant isolation was originally create to enable running tempest in parallel. |
| 37 | For each test class it creates a unique set of user credentials to use for the |
| 38 | tests in the class. It can create up to 3 sets of username, password, and |
| 39 | tenant/project names for a primary user, an admin user, and an alternate user. |
| 40 | To enable and use tenant isolation you only need to configure 2 things: |
| 41 | |
| 42 | #. A set of admin credentials with permissions to create users and |
| 43 | tenants/projects. This is specified in the identity section with the |
| 44 | admin_username, admin_tenant_name, and admin_password options |
| 45 | #. To enable tenant_isolation in the auth section with the |
| 46 | allow_tenant_isolation option. |
| 47 | |
| 48 | |
| 49 | Locking Test Accounts |
| 50 | """"""""""""""""""""" |
| 51 | For a long time using tenant isolation was the only method available if you |
| 52 | wanted to enable parallel execution of tempest tests. However this was |
| 53 | insufficient for certain use cases because of the admin credentials requirement |
| 54 | to create the credential sets on demand. To get around that the accounts.yaml |
| 55 | file was introduced and with that a new internal credential provider to enable |
| 56 | using the list of credentials instead of creating them on demand. With locking |
| 57 | test accounts each test class will reserve a set of credentials from the |
| 58 | accounts.yaml before executing any of its tests so that each class is isolated |
| 59 | like in tenant isolation. |
| 60 | |
| 61 | Currently, this mechanism has some limitations, first only non-admin users with |
| 62 | the same role set can be used at one time. The second limitation is around |
| 63 | networking, locking test accounts will only work with a single flat network as |
| 64 | the default for each tenant/project. If another network configuration is used |
| 65 | in your cloud you might face unexpected failures. |
| 66 | |
| 67 | To enable and use locking test accounts you need do a few things: |
| 68 | |
| 69 | #. Enable the locking test account provider with the |
| 70 | locking_credentials_provider option in the auth section |
| 71 | #. Create a accounts.yaml file which contains the set of pre-existing |
| 72 | credentials to use for testing. To make sure you don't have a credentials |
| 73 | starvation issue when running in parallel make sure you have at least 2 |
| 74 | times the number of parallel workers you are using to execute tempest |
| 75 | available in the file. |
| 76 | #. Provide tempest with the location of you accounts.yaml file with the |
| 77 | test_accounts_file option in the auth section |
| 78 | |
| 79 | |
| 80 | Non-locking test accounts |
| 81 | """"""""""""""""""""""""" |
| 82 | When tempest was refactored to allow for locking test accounts, the original |
| 83 | non-tenant isolated case was converted to support the new accounts.yaml file. |
| 84 | This mechanism is the non-locking test accounts provider. It only makes sense |
| 85 | to use it if parallel execution isn't needed. If the role restrictions were too |
| 86 | limiting with the locking accounts provider and tenant isolation is not wanted |
| 87 | then you can use the non-locking test accounts credential provider without the |
| 88 | accounts.yaml file. This is also the currently the default configuration for |
| 89 | tempest, since it doesn't require elevated permissions or the extra file. |
| 90 | |
| 91 | To use the non-locking test accounts provider you have 2 ways to configure it. |
| 92 | First you can specify the sets of credentials in the configuration file like |
| 93 | detailed above with following 9 options in the identity section: |
| 94 | |
| 95 | #. username |
| 96 | #. password |
| 97 | #. tenant_name |
| 98 | #. admin_username |
| 99 | #. admin_password |
| 100 | #. admin_tenant_name |
| 101 | #. alt_username |
| 102 | #. alt_password |
| 103 | #. alt_tenant_name |
| 104 | |
| 105 | You should use this if you need to specify credentials with different roles. |
| 106 | (i.e. you want to use admin credentials) However, this isn't a requirement for |
| 107 | its usage. |
| 108 | |
| 109 | You also can use the accounts.yaml file to specify the credentials used for |
| 110 | testing. This will just allocate them serially so you only need to provide |
| 111 | a pair of credentials. Do note that all the restrictions associated with |
| 112 | locking test accounts applies to using the accounts.yaml file this way too. |
| 113 | The procedure for doing this is very similar to with the locking accounts |
| 114 | provider just don't set the locking_credentials_provider to true and you |
| 115 | only should need a single pair of credentials. |