blob: bd6018d0db6f458ea258c424aae082778fcd16a3 [file] [log] [blame]
Matthew Treinish16dd51b2014-06-11 12:04:51 -04001Reviewing Tempest Code
2======================
3
4To start read the `OpenStack Common Review Checklist
Masayuki Igawa1608cc02016-04-11 13:54:38 +09005<http://docs.openstack.org/infra/manual/developers.html#peer-review>`_
Matthew Treinish16dd51b2014-06-11 12:04:51 -04006
7
8Ensuring code is executed
9-------------------------
10
11For any new or change to a test it has to be verified in the gate. This means
12that the first thing to check with any change is that a gate job actually runs
13it. Tests which aren't executed either because of configuration or skips should
14not be accepted.
15
16
17Unit Tests
18----------
19
20For any change that adds new functionality to either common functionality or an
21out-of-band tool unit tests are required. This is to ensure we don't introduce
22future regressions and to test conditions which we may not hit in the gate runs.
23Tests, and service clients aren't required to have unit tests since they should
24be self verifying by running them in the gate.
25
26
27API Stability
28-------------
29Tests should only be added for a published stable APIs. If a patch contains
30tests for an API which hasn't been marked as stable or for an API that which
31doesn't conform to the `API stability guidelines
32<https://wiki.openstack.org/wiki/Governance/Approved/APIStability>`_ then it
33should not be approved.
34
35
36Reject Copy and Paste Test Code
Matthew Treinishf45ba2e2015-08-24 15:05:01 -040037-------------------------------
Matthew Treinish16dd51b2014-06-11 12:04:51 -040038When creating new tests that are similar to existing tests it is tempting to
39simply copy the code and make a few modifications. This increases code size and
40the maintenance burden. Such changes should not be approved if it is easy to
41abstract the duplicated code into a function or method.
42
43
44Being explicit
45--------------
46When tests are being added that depend on a configurable feature or extension,
47polling the API to discover that it is enabled should not be done. This will
48just result in bugs being masked because the test can be skipped automatically.
49Instead the config file should be used to determine whether a test should be
50skipped or not. Do not approve changes that depend on an API call to determine
51whether to skip or not.
52
53
Matthew Treinish13a1ed62015-09-08 10:39:58 -040054Configuration Options
55---------------------
56With the introduction of the tempest external test plugin interface we needed
57to provide a stable contract for tempest's configuration options. This means
58we can no longer simply remove a configuration option when it's no longer used.
59Patches proposed that remove options without a deprecation cycle should not
60be approved. Similarly when changing default values with configuration we need
61to similarly be careful that we don't break existing functionality. Also, when
62adding options, just as before, we need to weigh the benefit of adding an
63additional option against the complexity and maintenance overhead having it
64costs.
65
66
Matthew Treinish55078882014-08-12 19:01:34 -040067Test Documentation
68------------------
69When a new test is being added refer to the :ref:`TestDocumentation` section in
70hacking to see if the requirements are being met. With the exception of a class
71level docstring linking to the API ref doc in the API tests and a docstring for
72scenario tests this is up to the reviewers discretion whether a docstring is
73required or not.
74
75
Matthew Treinish16dd51b2014-06-11 12:04:51 -040076When to approve
77---------------
78 * Every patch needs two +2s before being approved.
79 * Its ok to hold off on an approval until a subject matter expert reviews it
80 * If a patch has already been approved but requires a trivial rebase to merge,
81 you do not have to wait for a second +2, since the patch has already had
82 two +2s.