blob: 40a50f4edb1ffdae3dc6fbaa9e95dea66e5d1579 [file] [log] [blame]
Martin Kopecd76178e2024-01-16 20:43:56 +01001.. _serial_tests_guide:
2
3Tempest Field Guide to Serial tests
4===================================
5
6
7What are these tests?
8---------------------
9
10Tempest can run tests serially as well as in parallel, depending on the
11configuration that is fully up to the user. However, sometimes you need to
12make sure that tests are not interfering with each other via OpenStack
13resources with the other tests running in parallel. Tempest creates separate
14projects for each test class to separate project based resources between test
15cases.
16
17If your tests use resources outside of projects, e.g. host aggregates then
18you might need to explicitly separate interfering test cases. If you only need
19to separate a small set of test cases from each other then you can use the
20``LockFixture``.
21
22However, in some cases, a small set of tests needs to be run serially. For
23example, some of the host aggregate and availability zone testing needs
24compute nodes without any running nova server to be able to move compute hosts
25between availability zones. But many tempest tests start one or more nova
26servers.
27
28
29Why are these tests in Tempest?
30-------------------------------
31
32This is one of Tempest's core purposes, testing the integration between
33projects.
34
35
36Scope of these tests
37--------------------
38
39The tests should always use the Tempest implementation of the OpenStack API,
40as we want to ensure that bugs aren't hidden by the official clients.
41
42Tests should be tagged with which services they exercise, as
43determined by which client libraries are used directly by the test.
44
45
46Example of a good test
47----------------------
48
49While we are looking for interaction of 2 or more services, be specific in
50your interactions. A giant "this is my data center" smoke test is hard to
51debug when it goes wrong.
52
53The tests that need to be run serially need to be marked with the
54``@serial`` class decorator. This will make sure that even if tempest is
55configured to run the tests in parallel, these tests will always be executed
56separately from the rest of the test cases.
57
58Please note that due to test ordering optimization reasons test cases marked
59for ``@serial`` execution need to be put under ``tempest/serial_tests``
60directory. This will ensure that the serial tests will block the parallel tests
61in the least amount of time.