ansible/docs/docsite/rst/dev_guide/testing_sanity.rst
Sandra McCann 1af7c6c003
[docs][backport]Backportapalooza 10 (#71621)
* Feature freeze date has been merged with Ansible-2.10.0beta1 (#71494)

(cherry picked from commit c586d436fa)

* Add --allow-disabled to sanity docs (#71524)

(cherry picked from commit bc6461432e)

* Update intro_patterns.rst (#71542)

Call out the trailing comma when specifying a single host. Small snag that took me a while to notice.

(cherry picked from commit ec3920cef1)

* ansible-vault: Fix typo in help message (#71485)

(cherry picked from commit 215eb730e1)

* update install for 2.10 (#71543)

* update install for 2.10

(cherry picked from commit f75223d2c6)

* User guide overhaul, Table of Contents (#71553)

(cherry picked from commit b694dbadfe)

* update backport instructions for 2.11 (#71567)

* update backport instructions in docs/docsite/rst/community/development_process.rst

Co-authored-by: Matt Martz <matt@sivel.net>
(cherry picked from commit 7f9258b024)

* More docs updates to reflect collections ecosystem (#71597)

(cherry picked from commit 96aee766f4)

* DOCS: Mentions ansible-base, adds collections pointers to Community and Dev Guides (#71480)

(cherry picked from commit 29b20bd1b1)

Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Co-authored-by: Amin Vakil <info@aminvakil.com>
Co-authored-by: Matt Deacalion <matt@dirtymonkey.co.uk>
Co-authored-by: Fabien Malfoy <fabien.malfoy@laposte.net>
Co-authored-by: Alicia Cozine <879121+acozine@users.noreply.github.com>
2020-09-03 18:07:02 -05:00

53 lines
1.5 KiB
ReStructuredText

:orphan:
.. _testing_sanity:
************
Sanity Tests
************
.. contents:: Topics
Sanity tests are made up of scripts and tools used to perform static code analysis.
The primary purpose of these tests is to enforce Ansible coding standards and requirements.
Tests are run with ``ansible-test sanity``.
All available tests are run unless the ``--test`` option is used.
How to run
==========
.. note::
To run sanity tests using docker, always use the default docker image
by passing the ``--docker`` or ``--docker default`` argument.
.. note::
When using docker and the ``--base-branch`` argument,
also use the ``--docker-keep-git`` argument to avoid git related errors.
.. code:: shell
source hacking/env-setup
# Run all sanity tests
ansible-test sanity
# Run all sanity tests including disabled ones
ansible-test sanity --allow-disabled
# Run all sanity tests against against certain files
ansible-test sanity lib/ansible/modules/files/template.py
# Run all tests inside docker (good if you don't have dependencies installed)
ansible-test sanity --docker default
# Run validate-modules against a specific file
ansible-test sanity --test validate-modules lib/ansible/modules/files/template.py
Available Tests
===============
Tests can be listed with ``ansible-test sanity --list-tests``.
See the full list of :ref:`sanity tests <all_sanity_tests>`, which details the various tests and details how to fix identified issues.