Chapter 5. Using ostestr to Run Tempest
Ostestr is an OpenStack wrapper for the testr test runner.
You can view a list of the available tests:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr -l
$ ostestr -l
NoteBefore running tests, you can use
tempest cleanup --init-saved-state
to capture the current state. This will make cleanup easier. For more information see Chapter 6, Cleaning Tempest Resources.You can run specific tests using
ostestr
.To run just one test, use:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr --regex '(test_regex)'
ostestr --regex '(test_regex)'
To run multiple tests:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr --regex '(test1|test2|test3)'
ostestr --regex '(test1|test2|test3)'
5.1. Running Smoke Tests
Smoke testing is a type of preliminary testing which only covers the most important functionality. While they are not comprehensive, running smoke tests can save time if they do identify a problem.
To run the smoke tests:
ostestr --regex '(.*smoke)'
$ ostestr --regex '(.*smoke)'
5.2. Running Specific Tests Using Whitelist Files
A whitelist file contains specific tests to include.
Create a
whitelist.txt
file in your tempest workspace:Copy to Clipboard Copied! Toggle word wrap Toggle overflow touch whitelist.txt
$ touch whitelist.txt
Append all the tests you want to run to the
whitelist.txt
file:Copy to Clipboard Copied! Toggle word wrap Toggle overflow cat whitelist.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*
$ cat whitelist.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*
Run those tests using
ostestr
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr -w <path to whitelist tests file>
$ ostestr -w <path to whitelist tests file>
5.3. Skipping Tests Using Blacklist Files
A blacklist file contains a list of tests to exclude.
Create a
skip_test.txt
file in your tempest workspace:Copy to Clipboard Copied! Toggle word wrap Toggle overflow touch skip_test.txt
$ touch skip_test.txt
Append all the tests to skip to the
skip_test.txt
file.Copy to Clipboard Copied! Toggle word wrap Toggle overflow cat skip_test.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*
$ cat skip_test.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*
Run tests using
ostestr
:Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr -b <path to skip test file>
$ ostestr -b <path to skip test file>
You can run specific tests by skipping the listed tests:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr --regex '(tempest.api.object_storage) -b <path to skip test file>
ostestr --regex '(tempest.api.object_storage) -b <path to skip test file>
5.4. Running Tests in Parallel Concurrently, or Serially
Run the tests in series:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr --serial
$ ostestr --serial
Run the tests in parallel (this is the default):
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr --parallel
$ ostestr --parallel
Specify the number of workers to use when running tests in parallel:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr --concurrency _<workers>_
$ ostestr --concurrency _<workers>_
Alternatively:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ostestr -c _<workers>_
$ ostestr -c _<workers>_
By default, this is set to the number of CPUs.