In our pipeline we have two defined services, MongoDB and Redis.
Our first step is our backend tests which interact with both these services.
Approximately 20% of the time the step fails with: `MongoError: failed to connect to server [localhost:27017] on first connect` and I have to manually re-run the failed step.
In the screenshot below, multiple tests had already passed which created and closed connections to Mongo, only for it to fail later on. Other times it fails immediately.
pipelines:
default:
- step:
name: Server Test
image: <redacted>
script:
- cd express
- echo $dotenv | base64 -d > .env
- npm install
- npm test
services:
- mongo
- redis
- <other steps redacted>
definitions:
services:
mongo:
image: mongo
redis:
image: redis
Has anyone else come accross this issue?
Hi @Rob Wilson
Could you upload full logs for both your mongo service and script?
If mongo successfully starts all the time it looks like a race condition that you may be able to workaround by either adding additional checks in your script to see if it's up or adding delays.
Thanks,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.