Skip to content

Testing

Prerequisites

Use community references for examples on specific implementations:

Build and Install Local Collection

The collection must be built and installed locally to be tested.

Package built using semantic version from galaxy.yml and installed to local collections cache: ~/.ansible/collections/ansible_collections/{USER}/{COLLECTION}.

ansible-galaxy collection build -f  # -f (force) useful for repeated testing.
ansible-galaxy collection install -f  # -f (force) useful for repeated testing.
Collection will need to be rebuilt if changes (files or tests) were made.

Running Tests

Any change requires rebuilding, installing AND re-entering directory as inodes change.

Alway build and install before running tests.

# Always re-enter between installs - cd ~; cd -
cd ~/.ansible/collections/ansible_collections/{USER}/{COLLECTION}
ansible-test {unit,integration,sanity}
Reference: