I’ve been trying to improve my test job in one of my Go projects, which tries to connect to a mongo database. Here’s the config yml
test: &test
working_directory: /go/src/project
docker:
- image: ${AWS_REGISTRY}/docker-image-citools:go-dep
aws_auth:
aws_access_key_id: $AWS_ACCESS_KEY_ID
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY
- image: ${AWS_REGISTRY}/rabbitmq:latest
aws_auth:
aws_access_key_id: $AWS_ACCESS_KEY_ID
aws_secret_access_key: $AWS_SECRET_ACCESS_KEY
environment:
RABBITMQ_PUBLISHER_PASSWD: publisher
- image: circleci/mongo:3.4-jessie-ram
command: [mongod, --smallfiles]
ports:
- 27017:27017
version: 2
jobs:
tests:
<<: *test
steps:
- checkout:
path: /go/src/project
- attach_workspace:
at: /go/src/project
- run:
name: Go dep
command: $GOPATH/bin/dep ensure
- run:
name: Wait for rabbitmq user settings
command: |
LOGIN="failed"
while [[ "${LOGIN}" =~ failed ]]; do
LOGIN=$(curl -s -u publisher:publisher http://localhost:15672/api/whoami | jq -r '.reason')
sleep 3 && echo $LOGIN
done;
- run:
name: Go test
command: go test -v ./...
- persist_to_workspace:
root: .
I’ve tried to run locally using circleci cli, and it worked fine, but when I pushed the job fails with:
panic: no reachable servers [recovered]
panic: no reachable servers