Tuesday, 27 December 2016

docker - Running tests on circleci with depends_on on circleci

Answer


When having a docker-compose setup using depends_on for starting up a database and running migration before being able to run the tests.



How is the correct way to run the tests on circleci?



I've tried running docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm app according to another stackoverflow issue. The issue is that then my migrations doesn't run and my tests fails accordingly



My working config.yml looks like this, but do i have to run up before being able to run run when using depends_on. When just running the second run command my migration doesn't get called and my tests fails?




version: 2
jobs:
build:
machine: true
working_directory: ~/repo
steps:
- checkout
- run: docker-compose up -d
- run: docker-compose -f docker-compose.yml -f docker-compose.test.yml run --rm app



The important part of my docker-compose is:



version: "3.2"
services:
app:
command: npm run start
build:
context: .

depends_on:
- migration
- postgres


Which is overriding the command and volumes in docker-compose.test.yml



I would like to be able to run my test on circleci with one command, this is my first docker setup but i couldn't find any answers to this issue.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...