Gitlab CI - multiple dbs

Hi,

I was wondering if someone could help me with setting up multiple databases for testing with gitlab CI.

I’ve successfully run tests on a project with one db using something like

foo:
services:
- postgres:9.5
variables:
POSTGRES_DB: test_db
POSTGRES_USER: username
POSTGRES_PASSWORD: “password”
script:
- npm tests

is there a way to do this when I need multiple dbs for my tests?

something like
variables:
POSTGRES_DB: test_db_a, test_db_b, test_db_c

does not appear to work.

Thanks!

You could do it using the docker-in-docker syntax:

image: docker:latest
services:
  - docker:dind
build:
  script:
    docker run -d -p 5432:5432 --name postgres postgres
    docker exec postgres createdb -U postgres 'test_db_a'
    docker exec postgres createdb -U postgres 'test_db_b'
    ...

Unfortunately, you’ll have to do a lot more in docker syntax this way…