Ansible integration tests are tests designed to validate playbook functionality. Testing is executed by playbooks as well, making things a bit recursive. The tests are broken down into a few main categories:
- Non-destructive
- Destructive
- Cloud
- Windows
- Network
A more detailed explanation of the test categories can be found in the README.md file found at test/integration/README.md.
As with unit tests, individual integration tests can be executed, using the ansible-test utility located at test/runner/ansible-test. This is particularly important, as many of the integration tests require external resources, such as computer cloud accounts. Each directory in test/integration/targets is a target that can be tested individually. For example, to test ping functionality, use the ping target:
Note there is even a test in this suite designed to fail—and that, at the end, we see ok=7 and failed=0, meaning all tests passed. A large set of POSIX-compatible non-destructive integration tests run by continuous integration systems on proposed changes to Ansible can be executed with the following:
$ test/runner/ansible-test integration -v posix/ci/