Reference on how to test an Ansible Runner project

ShanDesai
Sun, 05 May 2024 19:17:16 +0000
Get Help

I have a repository with the structure same as that of the Directory Hierarchy as that mentioned by the Ansible Runner documentation.

The project is all playbooks and no roles. I have a tests directory where each subdirectory within it is a testcase which performs the following:

1. run the playbook to be tested

2. perform assertion tests

There is no Molecule or ansible-test here because the playbooks rely on mostly either builtin or some community.docker or community.general collections.

Each test case also has the same Directory Hierarchy Ansible Runner structure since it reflects an isolated test for the playbook under test.

The only thing I am currently hacking is copying the core inventory directory into each test case and then running the tests via a bash script which essentially is ansible-runner run.

I am looking for references or examples of how some Ansible Runner projects can be programmitcally tested either by using python test frameworks or something that is considered best practice in the ansible world

1 post - 1 participant