Docs: Elaborate on feature flag in HACKING file

This is to elaborate on feature flag functionality in Tempest's
HACKING.rst. Currently, there isn't much documentation on feature
flags in Tempest or how to add them. The only place feature
flag is mentioned is in this file. Since testtools.skip(Unless|If)
is a common way of using a feature flag, it is mentioned. Also,
Tempest's interaction with DevStack is an important thing to mention
when explaining how to introduce a new feature flag.

Change-Id: Ia47132fa596918e58f21ba9810c2c28ddcf0d584
This commit is contained in:
Felipe Monteiro 2018-03-26 21:51:52 -04:00
parent 4bcf7e1002
commit 356f0593ff
1 changed files with 16 additions and 5 deletions

View File

@ -363,13 +363,24 @@ to Tempest.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When adding tests for new features that were not in previous releases of the
projects the new test has to be properly skipped with a feature flag. Whether
this is just as simple as using the @utils.requires_ext() decorator to
check if the required extension (or discoverable optional API) is enabled or
projects the new test has to be properly skipped with a feature flag. This can
be just as simple as using the ``@utils.requires_ext()`` or
``testtools.skipUnless`` decorators to check if the required extension (or
discoverable optional API) or feature is enabled or can be as difficult as
adding a new config option to the appropriate section. If there isn't a method
of selecting the new **feature** from the config file then there won't be a
mechanism to disable the test with older stable releases and the new test won't
be able to merge.
mechanism to disable the test with older stable releases and the new test
won't be able to merge.
Introduction of a new feature flag requires specifying a default value for
the corresponding config option that is appropriate in the latest OpenStack
release. Because Tempest is branchless, the feature flag's default value will
need to be overridden to a value that is appropriate in earlier releases
in which the feature isn't available. In DevStack, this can be accomplished
by modifying Tempest's `lib installation script`_ for previous branches
(because DevStack is branched).
.. _lib installation script: http://git.openstack.org/cgit/openstack-dev/devstack/tree/lib/tempest
2. Bug fix on core project needing Tempest changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^