From c7636c952873780ec629e8de4b6a9c31660d568b Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Thu, 28 Dec 2017 22:59:43 +0100 Subject: [PATCH] Now use postgres in tests --- .gitlab-ci.yml | 5 ++++- api/config/settings/test.py | 6 ------ api/test.yml | 23 +++++++++++++++-------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d77d91f1..91b11e8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,11 +11,14 @@ stages: - deploy test_api: + services: + - postgres:9.4 stage: test image: funkwhale/funkwhale:base variables: PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache" - DATABASE_URL: "sqlite://" + DATABASE_URL: "postgresql://postgres@postgres/postgres" + before_script: - python3 -m venv --copies virtualenv - source virtualenv/bin/activate diff --git a/api/config/settings/test.py b/api/config/settings/test.py index db7b2141..a0b6b250 100644 --- a/api/config/settings/test.py +++ b/api/config/settings/test.py @@ -1,11 +1,5 @@ from .common import * # noqa SECRET_KEY = env("DJANGO_SECRET_KEY", default='test') -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': ':memory:', - } -} # Mail settings # ------------------------------------------------------------------------------ diff --git a/api/test.yml b/api/test.yml index bd3a98e4..c59ce45b 100644 --- a/api/test.yml +++ b/api/test.yml @@ -1,8 +1,15 @@ -test: - dockerfile: docker/Dockerfile.test - build: . - command: pytest - volumes: - - .:/app - environment: - - "DATABASE_URL=sqlite://" +version: '2' +services: + test: + build: + dockerfile: docker/Dockerfile.test + context: . + command: pytest + depends_on: + - postgres + volumes: + - .:/app + environment: + - "DATABASE_URL=postgresql://postgres@postgres/postgres" + postgres: + image: postgres -- GitLab