Tests#
All of our tests are written with Ansible and mostly follow this approach:
- They create a new Git repository.
- Add and commit some files from a list of files (in
tests/files
) into this Git repository. - Push this Git repository to a Git server (either locally or on GitHub).
- Send a trigger to a trigger service (for example a webhook to the webhook handler, which is the same as a real webhook that would be sent).
- Starts to monitor the URL at which the test would expect something to happen (like deploying a Node.js app that has the Git branch as an HTML text).
- Compares the result on the URL with the expected result.
Lagoon is mostly tested in 3 different ways:
1. Locally#
During local development, the best way to test is locally. All tests are started via make
. Make will download and build all the required dependencies.
make tests
This will run all defined tests. If you only want to run a subset of the tests, run make tests-list
to see all existing tests and run them individually.
For example, make tests/node
will run the Node.js Docker images tests.
In order to actually see what is happening inside the microservices, we can use make logs
:
make logs
Or only for a specific service:
make logs service=webhook-handler
2. Automated integration testing#
In order to test pull requests that are created against Lagoon, we have a fully automatic integration test running on a dedicated Jenkins instance: https://ci.lagoon.sh. It is defined inside the .Jenkinsfile
, and runs automatically for every pull request that is opened.
This will build all images, start a Kubernetes cluster and run a series of tests.
The tests can be found here: