I have been at this point several times now, and I am starting to wonder if I am alone with this struggle, or if I am just the last one, who did not find the holy grail yet. This is probably not a simple technical question, but maybe more about philosophies, so brace yourselves before reading on.
I am maintaining the checkmk.general collection, which contains both roles and modules.
All the below runs both on GitHub workflows and locally.
Now for roles, I am pretty happy with molecule, which to this day seems to be the go-to testing approach for Ansible roles, if one does not want to build something elaborate themselves. Any objections so far?
Now when it comes to modules, it gets more interesting: Sanity testing is one thing, that I do with ansible-test sanity --docker
. Easy-peasy.
I have no unit tests yet, as we do not have time to create them currently.
But the real beast are integration tests. As the collection targets a piece of software, I need to install the software first. Currently, I am using the aforementioned ansible-test integration --docker
approach, installing the software into the container and then running my module(s) against it within the container. This way, I have no external dependencies and the tests are mostly stable and reliable. This worked just fine until yesterday. But first: Can anyone comment, if the ansible-test $MODE --docker
is future-proof, or are we all moving towards Tox Ansible ultimately?
Moving on: Just yesterday my integration tests started failing, as the new quay.io/ansible/default-test-container:10.0.0
container was released, which seems to be built on Ubuntu 24.04. The reason for the failures is, that the oldstable version of my software does not support Ubuntu 24.04 anymore. I assume the older version of the container was based on Ubuntu 22.04 which all versions of my software support. Now I am looking for solutions/workarounds, that do not involve creating VMs at some cloud provider.
After drawing this rather complex picture, let me try to generalize the question that keeps haunting me: What is the best way to integration-test an Ansible collection against a software product, that needs to be installed locally, without using a complex environment with a lot of dependencies and a ton of resources at a cloud provider for VMs and such?
I am looking for all kinds of comments, no matter if they confirm my approach, show me a better strategy or tell me what a stupid dingo I am doing the things I do the way I do them.
Thanks everyone!