Testing
A core set of tests is being run by Github Actions CI. However, when developing new features/refactoring, a more comprehensive regression testing suite is needed.
You can run go test
to execute the tests found in glauth_test.go
– better, if it is installed, you can run goconvey
Since some tests cover TOTP, you will first need to install oathtool
in your environment.
You also must create a symbolink link called glauth
to make it easy for the test framework to find the executable. For instance:
1cd bin2ln -s glauth64 glauth
In order to test GLAuth against an LDAP backend, you will need docker. Run this command:
1docker run \ 2 --rm \ 3 -d \ 4 -p 389:389 \ 5 --name openldap-service \ 6 --hostname ldap-service \ 7 --env LDAP_ORGANISATION="GLauth" \ 8 --env LDAP_DOMAIN="glauth.com" \ 9 --env LDAP_ADMIN_PASSWORD="password" \10 --env LDAP_CONFIG_PASSWORD="password" \11 --env LDAP_BASE_DN="dc=glauth,dc=com" \12 -v $PWD/misc/openldap/config:/etc/ldap/slapd.d \13 -v $PWD/misc/openldap/db:/var/lib/ldap \14 osixia/openldap:latest
Refer to this page for a somewhat more in-depth overview of testing with OpenLDAP.