Closed ThomasSanson closed 1 year ago
Thank you for your contribution
I think we should clarify the title of this PR In my understanding, there are already tests - https://github.com/vitabaks/postgresql_cluster/actions/workflows/molecule.yml
I believe we are talking about additional tests here
It is important to note that the necessary tests are performed in the main playbook
here is an example:
https://github.com/vitabaks/postgresql_cluster/blob/master/roles/patroni/tasks/main.yml#L836 https://github.com/vitabaks/postgresql_cluster/blob/master/roles/etcd/tasks/main.yml#L122
You can find a lot of detailed checks in the code.
maybe so "Add tests for Ansible Verifier"
@vitabaks
It's important to note that there are two scopes of testing in our process:
I believe that both types of tests are necessary. However, I could consider combining them and initiating them at the right time. This is what I anticipate with the collection format: I will have a 'healthcheck' playbook that can be launched at any time to check the health status of our infrastructure. This playbook will itself be triggered by molecule's verify.
In summary, I differentiate between the tests performed during installation, which are an integral part of the installation process, and the verification tests performed at the end.
To provide a bit more context, I plan to implement the 'side_effect' in the future. This process will aim to disrupt a part of the infrastructure (for example, by killing a master container) to then launch the verify and ensure everything is working correctly (i.e., the recovery is successful). This is just an example to highlight the importance of conducting tests after the convergence (installation) phase.
https://github.com/confluentinc/cp-ansible/tree/7.4.0-post/molecule
Thank you for sharing your detailed testing approach. I find the idea of integrating both installation testing and post-installation verification compelling. The planned 'healthcheck' playbook and future 'side_effect' implementation certainly add robustness to the process. Looking forward to seeing these enhancements in action.
@ThomasSanson Let me know when you're done working on this PR.
@vitabaks all done for me, this pull request is ready
🚀 feat(molecule): add Postgres and Patroni tests ✨ feat(molecule): add etcd health check test 🐛 fix(molecule): enable verifier in molecule config The molecule configuration file was updated to enable the verifier. A new group_vars file was added to set the default Postgres database name, user, and password. Tests were added to check if PostgreSQL is running, listening on the default port, and if the database exists. A test was added to check the replication status of PostgreSQL. Tests were added to check the status of Patroni and etcd. These tests will help ensure that the application is running correctly and that the infrastructure is properly configured.