1

I'm trying to deploy a mongodb replica set when I run my integration tests, but I get the error below:

Failed to connect to DB {"error": "error ping-ing mongo: connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": (AuthenticationFailed) Authentication failed.", "errorVerbose": "connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": (AuthenticationFailed) Authentication failed

I've included my config.test.yml, docker-compose.testing.yml and Makefile files below.

config.test.yml

redis:
  url: localhost:10801
  max_idle_connections: 10
  max_active_connections: 10
mongo:
  uri: 'mongodb://localhost:27017/dev?retryWrites=true&connecttimeoutms=5000&authSource=admin'
  rewards_uri: 'mongodb://localhost:27017/dev?retryWrites=true&connecttimeoutms=5000&authSource=admin'
  username: user
  password: user

docker-compose.testing.yml

  mongodb:
    image: mongo:4.4
    hostname: mongodb
    ports:
      - "27017:27017"
    entrypoint: bash
    command:
      - "-c"
      # This script sets up a replica set, which is needed to use transactions.
      - >
        (sleep 5 && mongo --host mongodb:27017 --eval 'rs.initiate({"_id": "cblocal", "members": [{ "_id": 0, "host": "localhost:27017" }]})') &
        mongod --bind_ip_all --replSet cblocal
  redis_test:
    image: redis:6.2.1
    ports:
      - '10801:6379' #host:container

Makefile

test-integration:
    bazel test //consumer/service/integration_tests:integration_test
    bazel test //consumer/service/integration_tests/repository:integration_test
jbone
  • 71
  • 3

0 Answers0