From 01e4942a34c323a47bbf255d58a3ddd6badf61ae Mon Sep 17 00:00:00 2001
From: Neda Moeini <neda.moeini@GA0479-NMOEINI.local>
Date: Mon, 21 Aug 2023 17:36:32 +0200
Subject: [PATCH] Added postgres service to the gitlab-ci.

---
 .gitlab-ci.yml   | 7 +++++++
 test/conftest.py | 2 +-
 tox.ini          | 1 +
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6d8ff332..3ed25c8b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -13,9 +13,16 @@ run-tox-pipeline:
     - docker-executor
   image: python:3.10
 
+  services:
+    - postgres:15.4
+
   # Change pip's cache directory to be inside the project directory since we can
   # only cache local items.
   variables:
+    POSTGRES_DB: gso-test-db
+    POSTGRES_USER: gso
+    POSTGRES_PASSWORD: gso
+    DATABASE_URI_TEST: 'postgresql://gso:gso@postgres:5432/gso-test-db'
     PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
 
   # Pip's cache doesn't store the python packages
diff --git a/test/conftest.py b/test/conftest.py
index 138adc0b..626ea3fe 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -93,7 +93,7 @@ def data_config_filename(configuration_data) -> str:
 def db_uri():
     """Provide the database uri configuration to run the migration on."""
 
-    return os.environ.get("DATABASE_URI_TEST", "postgresql://nwa:nwa@localhost/nwa-workflows-test")
+    return os.environ.get("DATABASE_URI_TEST", "postgresql://gso:gos@localhost/gso-test-db")
 
 
 def run_migrations(db_uri: str) -> None:
diff --git a/tox.ini b/tox.ini
index ed2f8f9a..5c951293 100644
--- a/tox.ini
+++ b/tox.ini
@@ -8,6 +8,7 @@ max-line-length = 120
 ban-relative-imports = true
 
 [testenv]
+passenv = DATABASE_URI_TEST
 deps =
     coverage
     flake8
-- 
GitLab