I have a docker image built up for mongodb test. You can be found from zhaoyi0113/mongo-uat
. When start a docker container from this image, it will create a few mongodb instances which will take a few minutes to startup. Now I want to run my integration test cases inside this container by drone CI. Below is my .drone.yml file:
pipeline:
build:
image: node:latest
commands:
- npm install
- npm test
- npm run eslint
integration:
image: zhaoyi0113/mongo-uat
commands:
- npm install
- npm run integration
There are two steps in this pipeline, the first is to run unit test in a nodejs project. The second one integration
is used to run integration test cases in the mongodb docker image.
when I run drone exec
it will get an error failed to connect to mongo instance
. I think that because the mongodb instance needs a few minutes to startup. The commands npm install
and npm run integration
should be run after the mongodb instance launched. How can I delay the build commands?
EDIT1
The image zhaoyi0113/mongo-uat
has mongodb environment. It will create a few mongodb instances. I can run this command docker run -d zhaoyi0113/mongo-uat
to launch this container after that I can attach to this container to see the mongodb instances. I am not sure how drone launch the docker container.