Docker unit test setup

I want to set up a unit test environment for my product. I have a build of web applications on nginx in Lua that use mysql and redis. I think docker will be good for this, although I'm new to docker . My application runs on a centos server (production server).

I plan to install another container for mysql, redis and webapp, and then write a UT application (unit test for Lua using the Busted framework) in my mac (my MAC development machine) or VM to check it out. The UT application will talk to the nginx docker container, and nginx will use the mysql and redis container. It's good? If so, can someone help me how to do this? maybe a good link? If not, what could be better. I already tried using a stroller, but it took too much time, which should not be in my UT case.

+6
source share
2 answers

As an example, as we customize the project template, you can look at the phundament/app and its test setup.

We use an attached GitLab installation with a customized runner that is capable of docker-compose .

Attention! The runner himself runs on a separate Docker node.

We use docker-compose.yml to define services in the settings stack and for testing .

The CI configuration is optimized for processing several parallel tests of isolated stacks, this is done only by specifying the custom COMPOSE_PROJECT_NAME .

Some detailed documentation about our testing process and useful information about docker-compose and docked CI.

Finally, Travis CI also supports Docker over time, but I have not tested this approach at all.

+2
source

If you are new to CI on Docker, check out Drone:

There are some drawbacks to this solution (for example, image size), but it will save you from the reasons.

+1
source

All Articles