docker unit test setup
Asked Answered
I

2

6

I want to setup a unit test environment for my product. I have a web application build on nginx in Lua which use mysql and redis. I think docker will be good for this although i am new to docker. My application runs on centos server (production server).

I am planning to setup different container for mysql,redis and webapp and then write UT application (unit test for Lua using Busted framework) in my mac (My development machine is MAC) or VM to test it. The UT application will talk to docker container nginx and nginx will use container mysql and redis. Is this good ? If yes ,can someone guide me how to do this? maybe some good link? If no , what could be better way. I have already tried using vagrant but that took too much time which shouldn't be in my UT case.

Incubator answered 23/12, 2015 at 11:23 Comment(4)
thanks for edit @NicolBolasIncubator
I am afraid you are mixing terminology here. Unit tests are tests designed to check a component in isolation. What you are trying to run are integration tests in which you check how everything works together.Eyewitness
@Eyewitness i agree. Actually i am trying to setup environment for integration testing along with unit test setup (using busted framework). It will help me to test my app thoroughly.Incubator
I created this couple of months ago, may give you some ideas how to do this: github.com/boynux/docker-dustGreek
A
2

For an example how we setup our project template you may have a look at phundament/app and its testing setup.

We are using a dockerized GitLab installation with a customized runner, which is able to execute docker-compose.

Note! The runner itself is running on a separate Docker host.

We are using docker-compose.yml to define the services in a stack with adjustments for development and testing.

The CI configuration is optimized to handle multiple concurrent tests of isolated stacks, this is just done by specifying a custom COMPOSE_PROJECT_NAME.

Some in-depth documentation about our testing process and useful information about docker-compose and dockerized CI.

Finally, Travis CI also supports Docker since a while, but I haven't tested this approach at all.

Adrastus answered 4/1, 2016 at 23:36 Comment(0)
R
1

If you are new to Docker based CI, please look at Drone:

There some are drawbacks to this solution (like size of images), but it will get you off the grounds.

Reticle answered 4/1, 2016 at 10:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.