DEV Community

Cover image for Improving image-specific testing with actual examples
Toby Bellwood for Lagoon

Posted on

Improving image-specific testing with actual examples

In Lagoon 1.x, Lagoon ran a full battery of tests for every pull request submitted to the GitHub repository. Not only was this inefficient, but unrelated errors also added false negatives to the testing process. In addition, running these tests required a full local instance of Lagoon to be created, which presented a significant technical and resource hurdle for contributions. With the addition of Kubernetes, this hurdle was reduced, but still significant.

At the same time as completing the work on Lagoon 2, we have been working hard on a set of example projects for Lagoon – covering a wider range of frameworks, content management systems, and situations than previously. We have gathered these examples over at https://github.com/uselagoon/lagoon-examples as Git submodules to the source repositories and branches.

We will be taking advantage of these example projects to test our images. We have built a CI process that will build our images, clone, build, and test the relevant example projects using the images being modified. With the introduction of automated dependency resolution triggering CI builds, we have automated a large portion of the image production process.

The tests we will be using for the process have been written in Markdown, and are parsed into Mocha tests by the excellent Leia parser from the Lando team. These tests are human-readable and easy to contribute to. You can see an example at https://github.com/amazeeio/drupal-example-simple/blob/9.x-advanced/TESTING_dockercompose.md.

Likewise, we will be running the same set of tests inside these example projects to ensure the projects work with the latest and edge releases of the images prior to any changes being merged.

Discussion (0)