Integration tests

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.

Many of the integration tests require ssh to the localhost to be functional. Be sure that ssh works, ideally without a password prompt. Remote hosts can be used by altering the inventory file used for tests (test/integration/inventory).

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/
At the time of writing, a number of the posix/ci tests do not pass on macOS. Executing these tests in a recent Fedora environment is recommended.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.12.162.37