此内容没有您所选择的语言版本。
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:
ostestr -l
$ ostestr -lCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteBefore running tests, you can use
tempest cleanup --init-saved-stateto 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:
ostestr --regex '(test_regex)'
ostestr --regex '(test_regex)'Copy to Clipboard Copied! Toggle word wrap Toggle overflow To run multiple tests:
ostestr --regex '(test1|test2|test3)'
ostestr --regex '(test1|test2|test3)'Copy to Clipboard Copied! Toggle word wrap Toggle overflow
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.txtfile in your tempest workspace:touch whitelist.txt
$ touch whitelist.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Append all the tests you want to run to the
whitelist.txtfile:cat whitelist.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*
$ cat whitelist.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run those tests using
ostestr:ostestr -w <path to whitelist tests file>
$ ostestr -w <path to whitelist tests file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.3. Skipping Tests Using Blacklist Files 复制链接链接已复制到粘贴板!
A blacklist file contains a list of tests to exclude.
Create a
skip_test.txtfile in your tempest workspace:touch skip_test.txt
$ touch skip_test.txtCopy to Clipboard Copied! Toggle word wrap Toggle overflow Append all the tests to skip to the
skip_test.txtfile.cat skip_test.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*
$ cat skip_test.txt keystone_tempest_plugin.* networking_bgpvpn_tempest.tests*Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run tests using
ostestr:ostestr -b <path to skip test file>
$ ostestr -b <path to skip test file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow You can run specific tests by skipping the listed tests:
ostestr --regex '(tempest.api.object_storage) -b <path to skip test file>
ostestr --regex '(tempest.api.object_storage) -b <path to skip test file>Copy to Clipboard Copied! Toggle word wrap Toggle overflow
5.4. Running Tests in Parallel Concurrently, or Serially 复制链接链接已复制到粘贴板!
Run the tests in series:
ostestr --serial
$ ostestr --serialCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the tests in parallel (this is the default):
ostestr --parallel
$ ostestr --parallelCopy to Clipboard Copied! Toggle word wrap Toggle overflow Specify the number of workers to use when running tests in parallel:
ostestr --concurrency _<workers>_
$ ostestr --concurrency _<workers>_Copy to Clipboard Copied! Toggle word wrap Toggle overflow Alternatively:
ostestr -c _<workers>_
$ ostestr -c _<workers>_Copy to Clipboard Copied! Toggle word wrap Toggle overflow By default, this is set to the number of CPUs.