To start read the OpenStack Common Review Checklist
Any new test or change to an existing test has to be verified in the gate. This means that the first thing to check with any change is that a gate job actually runs it. Tests which aren’t executed either because of configuration or skips should not be accepted.
Along with checking that the jobs log that a new test is actually executed,
also pay attention to the execution time of that test. Patrole already runs
hundreds of tests per job in its check and gate pipelines and it is important
that the overall runtime of the jobs be constrained as much as possible.
Consider applying the @decorators.attr(type='slow')
test attribute decorator to a test if its runtime is longer than 30 seconds.
For any change that adds new functionality to common functionality unit tests are required. This is to ensure we don’t introduce future regressions and to test conditions which we may not hit in the gate runs.
Tests should only be added for published stable APIs. If a patch contains tests for an API which hasn’t been marked as stable or for an API which doesn’t conform to the API stability guidelines then it should not be approved.
Similarly, tests should only be added for policies that are covered by policy in code documentation. Any existing tests that test policies not covered by such documentation are either:
For the first bullet, the tests should not be considered stable, but should be kept around to maintain coverage. These tests are a best-effort attempt at offering RBAC test coverage for the service that has not yet migrated to policy in code.
For the second bullet, the tests should be updated to conform to policy in code documentation, if applicable.
When creating new tests that are similar to existing tests it is tempting to simply copy the code and make a few modifications. This increases code size and the maintenance burden. Such changes should not be approved if it is easy to abstract the duplicated code into a function or method.
When a new test is being proposed, question whether this feature is not already tested with Patrole. Patrole has more than 600 tests, spread amongst many directories, so it’s easy to introduce test duplication.
Test duplication means:
For the first bullet, try to avoid calling the same API inside the
self.override_role()
call.
Note
If the same API is tested against different policies, consider combining the different tests into only 1 test, that tests the API against all the policies it enforces.
For the second bullet, try to avoid testing the same policies across multiple tests.
Note
This is not always possible since policy granularity doesn’t exist for all APIs. In cases where policy granularity doesn’t exist, make sure that the policy overlap only exists for the non-granular APIs that enforce the same policy.
When tests are being added that depend on a configurable feature or extension, polling the API to discover that it is enabled should not be done. This will just result in bugs being masked because the test can be skipped automatically. Instead the config file should be used to determine whether a test should be skipped or not. Do not approve changes that depend on an API call to determine whether to skip or not.
Care should be taken when using multiple policies in an RBAC test. The following guidelines should be followed before deciding to add multiple policies to a Patrole test.
The list below enumerates guidelines beginning with those with the highest priority and ending with those with the lowest priority. A higher priority item takes precedence over lower priority items.
rules
parameter chronologically with respect
to the order they’re called by the API endpoint under test.Because Neutron can raise a 403 or 404 following failed authorization, Patrole
uses the expected_error_codes
parameter to accommodate this behavior.
Each policy action enumerated in rules
must have a corresponding entry
in expected_error_codes
. Each expected error code must be either a 403 or a
404, which indicates that, when policy enforcement fails for the corresponding
policy action, that error code is expected by Patrole. For more information
about these parameters, see RBAC Rule Validation Module.
The list below enumerates additional multi-policy guidelines that apply in particular to Neutron. A higher priority item takes precedence over lower priority items.
expected_error_codes
parameter
chronologically with respect to the order each corresponding policy in
rules
is authorized by the API under test.The same guidelines under General Multi-policy API Code Guidelines should be applied afterward.
Release notes are how we indicate to users and other consumers of Patrole what has changed in a given release. There are certain types of changes that require release notes and we should not approve them without including a release note. These include but aren’t limited to, any addition, deprecation or removal from the framework code, any change to configuration options (including deprecation), major feature additions, and anything backwards incompatible or would require a user to take note or do something extra.
Sometimes we have some bugs in deprecated code. Basically, we leave it. Because we don’t need to maintain it. However, if the bug is critical, we might need to fix it. When it will happen, we will deal with it on a case-by-case basis.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.