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 |
Matthew Treinish | 077a563 | 2014-06-04 11:43:10 -0400 | [diff] [blame] | 10 | ----------------- |
Sean Dague | a26454d | 2013-11-01 18:09:55 -0400 | [diff] [blame] | 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), |
Matthew Treinish | 464d287 | 2015-04-29 12:23:01 -0400 | [diff] [blame] | 21 | or libraries. |
Sean Dague | a26454d | 2013-11-01 18:09:55 -0400 | [diff] [blame] | 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 | |
Shuquan Huang | 06c632b | 2015-08-05 09:39:58 +0000 | [diff] [blame] | 44 | The easiest way to create a configuration file is to generate a sample |
| 45 | 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 |
Shuquan Huang | 06c632b | 2015-08-05 09:39:58 +0000 | [diff] [blame] | 48 | $> oslo-config-generator --config-file \ |
| 49 | tools/config/config-generator.tempest.conf \ |
| 50 | --output-file etc/tempest.conf |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 51 | |
Brian Lamar | 930fc5b | 2011-12-08 11:51:26 -0500 | [diff] [blame] | 52 | After that, open up the ``etc/tempest.conf`` file and edit the |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 53 | configuration variables to match valid data in your environment. |
| 54 | This includes your Keystone endpoint, a valid user and credentials, |
| 55 | and reference data to be used in testing. |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 56 | |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 57 | .. note:: |
Justin Shepherd | 0d9bbd1 | 2011-08-11 12:57:44 -0500 | [diff] [blame] | 58 | |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 59 | If you have a running devstack environment, Tempest will be |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 60 | automatically configured and placed in ``/opt/stack/tempest``. It |
| 61 | will have a configuration file already set up to work with your |
| 62 | devstack installation. |
Jay Pipes | 7f75763 | 2011-12-02 15:53:32 -0500 | [diff] [blame] | 63 | |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 64 | Tempest is not tied to any single test runner, but `testr`_ is the most commonly |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 65 | used tool. Also, the nosetests test runner is **not** recommended to run Tempest. |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 66 | |
| 67 | After setting up your configuration file, you can execute the set of Tempest |
| 68 | tests by using ``testr`` :: |
Attila Fazekas | 58d2330 | 2013-07-24 10:25:02 +0200 | [diff] [blame] | 69 | |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 70 | $> testr run --parallel |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 71 | |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 72 | .. _testr: http://testrepository.readthedocs.org/en/latest/MANUAL.html |
Attila Fazekas | 58d2330 | 2013-07-24 10:25:02 +0200 | [diff] [blame] | 73 | |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 74 | To run one single test serially :: |
| 75 | |
| 76 | $> testr run 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] | 77 | |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 78 | Alternatively, you can use the run_tempest.sh script which will create a venv |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 79 | and run the tests or use tox to do the same. Tox also contains several existing |
| 80 | job configurations. For example:: |
| 81 | |
| 82 | $> tox -efull |
| 83 | |
| 84 | which will run the same set of tests as the OpenStack gate. (it's exactly how |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 85 | the gate invokes Tempest) Or:: |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 86 | |
| 87 | $> tox -esmoke |
| 88 | |
| 89 | to run the tests tagged as smoke. |
| 90 | |
nayna-patel | ddb489c | 2012-11-13 22:06:45 +0000 | [diff] [blame] | 91 | |
Daryl Walleck | e36f623 | 2012-03-06 00:21:45 -0600 | [diff] [blame] | 92 | Configuration |
| 93 | ------------- |
| 94 | |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 95 | Detailed configuration of Tempest is beyond the scope of this |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 96 | document see :ref:`tempest-configuration` for more details on configuring |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 97 | Tempest. The etc/tempest.conf.sample attempts to be a self documenting version |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 98 | of the configuration. |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 99 | |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 100 | You can generate a new sample tempest.conf file, run the following |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 101 | command from the top level of the Tempest directory: |
Masayuki Igawa | ac401c7 | 2014-11-18 15:28:46 +0900 | [diff] [blame] | 102 | |
| 103 | tox -egenconfig |
Matthew Treinish | 6eb0585 | 2013-11-26 15:28:12 +0000 | [diff] [blame] | 104 | |
Sean Dague | b56052b | 2013-05-21 17:57:41 -0400 | [diff] [blame] | 105 | The most important pieces that are needed are the user ids, openstack |
Matthew Treinish | a970d65 | 2015-03-11 15:39:24 -0400 | [diff] [blame] | 106 | endpoint, and basic flavors and images needed to run tests. |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 107 | |
| 108 | Unit Tests |
| 109 | ---------- |
| 110 | |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 111 | Tempest also has a set of unit tests which test the Tempest code itself. These |
Atsushi SAKAI | 0a183b8 | 2015-07-28 21:52:17 +0900 | [diff] [blame] | 112 | tests can be run by specifying the test discovery path:: |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 113 | |
| 114 | $> OS_TEST_PATH=./tempest/tests testr run --parallel |
| 115 | |
| 116 | By setting OS_TEST_PATH to ./tempest/tests it specifies that test discover |
| 117 | should only be run on the unit test directory. The default value of OS_TEST_PATH |
| 118 | is OS_TEST_PATH=./tempest/test_discover which will only run test discover on the |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 119 | Tempest suite. |
Matthew Treinish | a7c7f9f | 2014-01-13 18:20:50 +0000 | [diff] [blame] | 120 | |
| 121 | Alternatively, you can use the run_tests.sh script which will create a venv and |
Matthew Treinish | 3460aaa | 2015-05-11 22:18:00 -0400 | [diff] [blame] | 122 | run the unit tests. There are also the py27 and py34 tox jobs which will run |
| 123 | the unit tests with the corresponding version of python. |
Matthew Treinish | af37dc9 | 2014-02-13 14:35:38 -0500 | [diff] [blame] | 124 | |
| 125 | Python 2.6 |
| 126 | ---------- |
| 127 | |
Matthew Treinish | d28dd7b | 2015-02-23 11:52:33 -0500 | [diff] [blame] | 128 | Starting in the kilo release the OpenStack services dropped all support for |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 129 | python 2.6. This change has been mirrored in Tempest, starting after the |
| 130 | tempest-2 tag. This means that proposed changes to Tempest which only fix |
Matthew Treinish | d28dd7b | 2015-02-23 11:52:33 -0500 | [diff] [blame] | 131 | python 2.6 compatibility will be rejected, and moving forward more features not |
Joe H. Rahme | 00a7542 | 2015-03-16 17:46:24 +0100 | [diff] [blame] | 132 | present in python 2.6 will be used. If you're running your OpenStack services |
| 133 | on an earlier release with python 2.6 you can easily run Tempest against it |
Matthew Treinish | d28dd7b | 2015-02-23 11:52:33 -0500 | [diff] [blame] | 134 | from a remote system running python 2.7. (or deploy a cloud guest in your cloud |
| 135 | that has python 2.7) |
Matthew Treinish | 3460aaa | 2015-05-11 22:18:00 -0400 | [diff] [blame] | 136 | |
| 137 | Python 3.4 |
| 138 | ---------- |
| 139 | |
| 140 | Starting during the Liberty release development cycle work began on enabling |
| 141 | Tempest to run under both Python 2.7 and Python 3.4. Tempest strives to fully |
| 142 | support running with Python 3.4. A gating unit test job was added to also run |
| 143 | Tempest's unit tests under Python 3.4. This means that the Tempest code at |
| 144 | least imports under Python 3.4 and things that have unit test coverage will |
| 145 | work on Python 3.4. However, because large parts of Tempest are self verifying |
| 146 | there might be uncaught issues running on Python 3.4. So until there is a gating |
| 147 | job which does a full Tempest run using Python 3.4 there isn't any guarantee |
| 148 | that running Tempest under Python 3.4 is bug free. |