Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 1 | Tempest - The OpenStack Integration Test Suite |
| 2 | ============================================== |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 3 | |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 4 | This is a set of integration tests to be run against a live OpenStack |
| 5 | cluster. Tempest has batteries of tests for OpenStack API validation, |
| 6 | Scenarios, and other specific tests useful in validating an OpenStack |
| 7 | deployment. |
| 8 | |
Sean Dague | a26454d | 2013-11-01 18:09:55 -0400 | [diff] [blame] | 9 | Design Principles |
| 10 | ---------- |
| 11 | Tempest Design Principles that we strive to live by. |
| 12 | |
| 13 | - Tempest should be able to run against any OpenStack cloud, be it a |
| 14 | one node devstack install, a 20 node lxc cloud, or a 1000 node kvm |
| 15 | cloud. |
| 16 | - Tempest should be explicit in testing features. It is easy to auto |
| 17 | discover features of a cloud incorrectly, and give people an |
| 18 | incorrect assessment of their cloud. Explicit is always better. |
| 19 | - Tempest uses OpenStack public interfaces. Tests in Tempest should |
| 20 | only touch public interfaces, API calls (native or 3rd party), |
| 21 | public CLI or libraries. |
| 22 | - Tempest should not touch private or implementation specific |
| 23 | interfaces. This means not directly going to the database, not |
| 24 | directly hitting the hypervisors, not testing extensions not |
| 25 | included in the OpenStack base. If there is some feature of |
| 26 | OpenStack that is not verifiable through standard interfaces, this |
| 27 | should be considered a possible enhancement. |
| 28 | - Tempest strives for complete coverage of the OpenStack API and |
| 29 | common scenarios that demonstrate a working cloud. |
| 30 | - Tempest drives load in an OpenStack cloud. By including a broad |
| 31 | array of API and scenario tests Tempest can be reused in whole or in |
| 32 | parts as load generation for an OpenStack cloud. |
| 33 | - Tempest should attempt to clean up after itself, whenever possible |
| 34 | we should tear down resources when done. |
| 35 | - Tempest should be self testing. |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 36 | |
| 37 | Quickstart |
| 38 | ---------- |
| 39 | |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 40 | To run Tempest, you first need to create a configuration file that |
| 41 | will tell Tempest where to find the various OpenStack services and |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 42 | other testing behavior switches. |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 43 | |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 44 | The easiest way to create a configuration file is to copy the sample |
| 45 | one in the ``etc/`` directory :: |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 46 | |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 47 | $> cd $TEMPEST_ROOT_DIR |
Brian Lamar | 930fc5b | 2011-12-08 11:51:26 -0500 | [diff] [blame] | 48 | $> cp etc/tempest.conf.sample etc/tempest.conf |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 49 | |
Brian Lamar | 930fc5b | 2011-12-08 11:51:26 -0500 | [diff] [blame] | 50 | After that, open up the ``etc/tempest.conf`` file and edit the |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 51 | configuration variables to match valid data in your environment. |
| 52 | This includes your Keystone endpoint, a valid user and credentials, |
| 53 | and reference data to be used in testing. |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 54 | |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 55 | .. note:: |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 56 | |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 57 | If you have a running devstack environment, tempest will be |
| 58 | automatically configured and placed in ``/opt/stack/tempest``. It |
| 59 | will have a configuration file already set up to work with your |
| 60 | devstack installation. |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 61 | |
Matthew Treinish | b17460e | 2013-09-17 17:04:03 +0000 | [diff] [blame] | 62 | Tempest is not tied to any single test runner, but testr is the most commonly |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 63 | used tool. After setting up your configuration file, you can execute |
Matthew Treinish | b17460e | 2013-09-17 17:04:03 +0000 | [diff] [blame] | 64 | the set of Tempest tests by using ``testr`` :: |
Attila Fazekas | 58d2330 | 2013-07-24 10:25:02 +0200 | [diff] [blame] | 65 | |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 66 | $> testr run --parallel |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 67 | |
nayna-patel | ddb489c | 2012-11-13 22:06:45 +0000 | [diff] [blame] | 68 | To run one single test :: |
Attila Fazekas | 58d2330 | 2013-07-24 10:25:02 +0200 | [diff] [blame] | 69 | |
Masayuki Igawa | fd52ac2 | 2013-12-24 18:20:50 +0900 | [diff] [blame] | 70 | $> testr run --parallel tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server |
Matthew Treinish | b17460e | 2013-09-17 17:04:03 +0000 | [diff] [blame] | 71 | |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 72 | Alternatively, you can use the run_tempest.sh script which will create a venv |
Matthew Treinish | b17460e | 2013-09-17 17:04:03 +0000 | [diff] [blame] | 73 | and run the tests or use tox to do the same. |
nayna-patel | ddb489c | 2012-11-13 22:06:45 +0000 | [diff] [blame] | 74 | |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 75 | Configuration |
| 76 | ------------- |
| 77 | |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 78 | Detailed configuration of tempest is beyond the scope of this |
| 79 | document. The etc/tempest.conf.sample attempts to be a self |
| 80 | documenting version of the configuration. |
| 81 | |
Matthew Treinish | 6eb0585 | 2013-11-26 15:28:12 +0000 | [diff] [blame] | 82 | The sample config file is auto generated using the script: |
| 83 | tools/generate_sample.sh |
| 84 | |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 85 | The most important pieces that are needed are the user ids, openstack |
| 86 | endpoints, and basic flavors and images needed to run tests. |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 87 | |
| 88 | Common Issues |
| 89 | ------------- |
| 90 | |
| 91 | Tempest was originally designed to primarily run against a full OpenStack |
| 92 | deployment. Due to that focus, some issues may occur when running Tempest |
| 93 | against devstack. |
| 94 | |
| 95 | Running Tempest, especially in parallel, against a devstack instance may |
| 96 | cause requests to be rate limited, which will cause unexpected failures. |
| 97 | Given the number of requests Tempest can make against a cluster, rate limiting |
| 98 | should be disabled for all test accounts. |
| 99 | |
| 100 | Additionally, devstack only provides a single image which Nova can use. |
| 101 | For the moment, the best solution is to provide the same image uuid for |
| 102 | both image_ref and image_ref_alt. Tempest will skip tests as needed if it |
| 103 | detects that both images are the same. |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 104 | |
| 105 | Unit Tests |
| 106 | ---------- |
| 107 | |
| 108 | Tempest also has a set of unit tests which test the tempest code itself. These |
| 109 | tests can be run by specifing the test discovery path:: |
| 110 | |
| 111 | $> OS_TEST_PATH=./tempest/tests testr run --parallel |
| 112 | |
| 113 | By setting OS_TEST_PATH to ./tempest/tests it specifies that test discover |
| 114 | should only be run on the unit test directory. The default value of OS_TEST_PATH |
| 115 | is OS_TEST_PATH=./tempest/test_discover which will only run test discover on the |
| 116 | tempest suite. |
| 117 | |
| 118 | Alternatively, you can use the run_tests.sh script which will create a venv and |
| 119 | run the unit tests. There are also the py26, py27, or py33 tox jobs which will |
| 120 | run the unit tests with the corresponding version of python. |
Matthew Treinish | af37dc9 | 2014-02-13 14:35:38 -0500 | [diff] [blame] | 121 | |
| 122 | Python 2.6 |
| 123 | ---------- |
| 124 | |
| 125 | Tempest can be run with Python 2.6 however the unit tests and the gate |
| 126 | currently only run with Python 2.7, so there are no guarantees about the state |
| 127 | of tempest when running with Python 2.6. Additionally, to enable testr to work |
| 128 | with tempest using python 2.6 the discover module from the unittest-ext |
| 129 | project has to be patched to switch the unittest.TestSuite to use |
| 130 | unittest2.TestSuite instead. See:: |
| 131 | |
| 132 | https://code.google.com/p/unittest-ext/issues/detail?id=79 |