ceb474bb9e
Batch of docs backports: * docs: Clarify include_task v import_tasks with conditionals (#43856) (cherry picked from commit6be42a2a0e
) * Add single quotes around package name (#45152) (cherry picked from commit0d81386144
) * prefer ansible_facts namespace and dict notation (#44980) (cherry picked from commit44510448b0
) * fix cherrypick conflict - scenario_guides * Update implicit_localhost.rst (#45455) (cherry picked from commitf68cd1acc6
) * updated fbsd install instructions (#45309) (cherry picked from commite9c2695ce7
) * Change "Defaulting Undefined Variables" (#41379) (cherry picked from commite35c4be1c1
) * adds license details to dev guide pages (#45574) (cherry picked from commit6e68d77f6d
) * FAQ: fix a typo, add link to 'vars' lookup (#42412) (cherry picked from commit95649dc793
) * Fix link and toctree (#45595) (cherry picked from commit6999bf318f
) * Improve the local toctree (and title) (#45590) (cherry picked from commitafea00fa9f
) * Add undocumented configuration parameter and explain in porting guide (#36059) (cherry picked from commita892a6ef03
) * Simplify PPA installation for Ubuntu (#45690) (cherry picked from commit78e9f452a5
) * adding git+ssh uri scheme (#36025) (cherry picked from commit84a4257774
) * Add workaround for non-standard kerberos environments (#41465) (cherry picked from commit4e532e0ad9
) * Restore license agreement (#45809) (cherry picked from commitf430f60541
) * partial cherry-pick - lenovo doc update PR 45483
79 lines
2.3 KiB
ReStructuredText
79 lines
2.3 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.
|
|
|
|
Available Tests
|
|
===============
|
|
|
|
Tests can be listed with ``ansible-test sanity --list-tests``.
|
|
|
|
This list is a combination of two different categories of tests, "Code Smell" and "Built-in".
|
|
|
|
Code Smell Tests
|
|
----------------
|
|
|
|
Miscellaneous `scripts <https://github.com/ansible/ansible/tree/devel/test/sanity/code-smell/>`_ used for enforcing coding standards and requirements, identifying trip hazards, etc.
|
|
|
|
These tests are listed and accessed by script name. There is no actual test named ``code-smell``.
|
|
|
|
All executable scripts added to the ``code-smell`` directory are automatically detected and executed by ``ansible-test``.
|
|
|
|
Scripts in the directory which fail can be skipped by adding them to `skip.txt <https://github.com/ansible/ansible/blob/devel/test/sanity/code-smell/skip.txt>`_.
|
|
This is useful for scripts which identify issues that have not yet been resolved in the code base.
|
|
|
|
Files tested are specific to the individual test scripts and are not affected by command line arguments.
|
|
|
|
Built-in Tests
|
|
--------------
|
|
|
|
These tests are integrated directly into ``ansible-test``.
|
|
All files relevant to each test are tested unless specific files are specified.
|
|
|
|
A full list of tests can be obtained by doing ``ansible-test sanity --list-tests``.
|
|
|
|
ansible-doc
|
|
~~~~~~~~~~~
|
|
|
|
Verifies that ``ansible-doc`` can parse module documentation on all supported python versions.
|
|
|
|
pep8
|
|
~~~~
|
|
|
|
Python static analysis for PEP 8 style guideline compliance. See :doc:`testing_pep8` for more information.
|
|
|
|
pylint
|
|
~~~~~~
|
|
|
|
Python static analysis for common programming errors.
|
|
|
|
rstcheck
|
|
~~~~~~~~
|
|
|
|
Check reStructuredText files for syntax and formatting issues.
|
|
|
|
shellcheck
|
|
~~~~~~~~~~
|
|
|
|
Static code analysis for shell scripts using the excellent `shellcheck <https://www.shellcheck.net/>`_ tool.
|
|
|
|
validate-modules
|
|
~~~~~~~~~~~~~~~~
|
|
|
|
Analyze modules for common issues in code and documentation. See :doc:`testing_validate-modules` for more information.
|
|
|
|
yamllint
|
|
~~~~~~~~
|
|
|
|
Check YAML files for syntax and formatting issues.
|