In the tests folder I put complete test playbooks that can be executed on any host without any requirements besides the role intself, I execute them on localhost. This is just another source of quick tests for the role, I design these playbooks specifically for that purpose. I have also molecule and other tests.
As far as I know there is no community or ansible standard what to put there, moreover almost all the roles I’ve seen have no content in the tests folder.
@kks , how exactly do you invoke such test playbooks?
I’ve got a few roles with some ad hoc tests in ./tests/test.yml, but I end up with a little forest of unreproducible symbolic links and inconsistent one-off notes about how to run the tests. I’ve never figured out how those playbooks under ./tests/ are supposed to be run.
I think in several places already I’ve advocated for this kind of folders structure - from my point of view it simplifies a lot of things.
In the tests folder inside role I use FQCN for the role ..<role_name>
I simply run all the yaml files with the name test_*.yml from tests folders. Find them with find command and run them with ansible-playbook from the root of the project with environment variable ANSIBLE_COLLECTIONS_PATH=.:$ANSIBLE_COLLECTIONS_PATH. Ansible find all the collections inside this repo first in that case. So I just have to update the role or test inplace without commit or installation and all tests (from tests folder) will run correctly.