I have a fairly simple CI script with two stages. The first stage succeeds but the test stage fails with the following error.
Uncaught Error: Redis connection to redisio:6379 failed - getaddrinfo ENOTFOUND redisio redisio:6379
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
Any help would be appreciated.
Here is my script:
image: node:8.11.2
stages:
- build
- test
- deploy
cache:
paths:
- node_modules/
install_deps:
stage: build
script:
- yarn install
- yarn lint
run_tests:
stage: test
script:
- npm install -g mocha --save-dev
- yarn install
- yarn test
services:
- name: redis:5.0
alias: redisio
- name: mdillon/postgis:9.6
alias: postgres
variables:
REDIS_HOST: redisio
REDIS_PORT: 6379
POSTGRES_SQL_HOST: postgres
NODE_ENV: test
POSTGRES_SQL_DATABASE: fluzfluz_backend_test
POSTGRES_SQL_USER: test_user
POSTGRES_SQL_PASSWORD: test_user_password
POSTGRES_SQL_PORT: 5432
# Necessary to setup the postgres service.
POSTGRES_USER: test_user
POSTGRES_PASSWORD: test_user_password
POSTGRES_DB: fluzfluz_backend_test