Skip to content

Can't connect directly to redis from integration test #12

@cesarvarela

Description

@cesarvarela

HI, I'm trying to connect directly to the redis server from the integration test by adding a container_name to the redis service in the compose yaml like this:

version: '2'

services:

  counter:
    image: gcr.io/${PROJECT_ID}/gcb-docker-compose:latest
    container_name: counter
    depends_on:
      - redis
    ports:
      - "50051:50051"
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379

  redis:
    container_name: redis
    image: redis
    ports:
      - "6379:6379"

networks:
    default:
        external:
            name: cloudbuild

And then doing in the integration test step:

const redisClient = redis.createClient({host: 'redis', port: '6379');

But I get an error in the cloud build console:

Step #2: (node:26) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 192.168.10.4:6379
Step #2:     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)

Any idea why?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions