Document salttesting helpers

This commit is contained in:
Mike Place 2016-09-21 23:26:59 +09:00
parent 3947712e2d
commit c54ad1c555
No known key found for this signature in database
GPG Key ID: 9136F4F13705CFD3

View File

@ -415,3 +415,40 @@ question if the path forward is unclear.
there may be new functionality in the file that is present in the new release branch
that is untested.It would be wise to see if new functionality could use additional
testing once the test file has propagated to newer release branches.
Test Helpers
------------
Several Salt-specific helpers are available. A full list is available by inspecting
functions exported in `salttesting.helpers`.
`@expensiveTest` -- Designates a test which typically requires a relatively costly
external resources, like a cloud virtual machine. This decorator is not normally
used by developers outside of the Salt core team.
`@destructiveTest` -- Marks a test as potentially destructive. It will not be run
by the test runner unles the ``-run-destructive`` test is expressly passed.
`@requires_network` -- Requires a network connection for the test to operate
successfully. If a network connection is not detected, the test will not run.
`@requires_salt_modules` -- Requires all the modules in a list of modules in
order for the test to be executed. Otherwise, the test is skipped.
`@requires_system_grains` -- Loads and passes the grains on the system as an
keyword argument to the test function with the name `grains`.
`@skip_if_binaries_missing(['list', 'of', 'binaries'])` -- If called from inside a test,
the test will be skipped if the binaries are not all present on the system.
`@skip_if_not_root` -- If the test is not executed as root, it will be skipped.
`@with_system_user` -- Creates an optionally destroy a system user within a test case.
See implementation details in `salttesting.helpers` for details.
`@with_system_group` -- Creates an optionally destroy a system group within a test case.
See implementation details in `salttesting.helpers` for details.
`@with_system_user_and_group` -- Creates an optionally destroy a system user and group
within a test case. See implementation details in `salttesting.helpers` for details.