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