Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker unit test setup

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.

like image 806
Nishant Kumar Avatar asked Dec 23 '15 11:12

Nishant Kumar


1 Answers

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.

  • #testing README
  • #testing Docs
  • CI builds
  • Extending services and Compose files
  • Docker-in-Docker for CI?

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

like image 131
schmunk Avatar answered Oct 11 '22 15:10

schmunk