Closed l00ptr closed 2 years ago
I have updated the current tests to make sure that login works (with the demo credentials).
I'm not familiar with Molecule and Travis, does it allow provisionning temporary VMs that we could run our test playbook in? Could you provide an example of such configuration?
you can use molecule tempory VMs/Container (docker) to test your role. With molecule you can use Goss, inspect or testinfra as a verifer to check the result of your role.
Travis allows you to run operation into a dedicated tempory VM, most of the time I have seen people using travis with docker. If you need more information, you can read roles and molecule tests from Jeff Geerling (geerlingguy).
https://github.com/geerlingguy/ansible-role-postgresql/tree/master/molecule/default
Best regards, J.
Hi,
CI is running on my fork of your repo : https://github.com/l00ptr/ansible-lemonldapng/actions/runs/1090411821
LemonLDAP tests are failling (LemonLDAP return a 500 because it cannot find a config) due to this bug : https://gitlab.ow2.org/lemonldap-ng/lemonldap-ng/-/issues/2566.
I can run my test locally by following the next steps :)
First you need to install and configure molecule and the molecule docker driver :
pip install molecule
pip install molecule[docker]
Then we can run our tests from the ansible project directory with the following command :
MOLECULE_DISTRO=debian10 molecule test
This command fails due to the bug issues/2566, so we can run the scenario step by step with those commmands :
MOLECULE_DISTRO=debian10 molecule converge
Connect to the container :
MOLECULE_DISTRO=debian10 molecule login
sed -i -e '/cfgNum/a "cfgDate": 1625821798, ' /var/lib/lemonldap-ng/conf/lmConf-1.json
rm -fr /var/cache/lemonldap-ng/lemonldap-ng-config/*
Disconnect from this container and then run the verify step :
MOLECULE_DISTRO=debian10 molecule verify
should be fixed #7
It could be nice to test your role with molecule and run through travis.