From c4f9ea2dfe393a90e611ac195be284cbf70e2ea2 Mon Sep 17 00:00:00 2001
From: Lucas Brandstaetter <lucas@brandstaetter.tech>
Date: Thu, 17 Oct 2024 23:29:33 +0000
Subject: [PATCH] Update integration tests in gitlab-ci.yml

Use tox to run the integration tests.
---
 .gitlab-ci.yml | 45 ++++++++++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 17 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8ef62790d..3ecf97423 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -105,7 +105,6 @@ default:
       }
       EOF
 
-
 generate_css:
   extends:
     - .default-rules
@@ -275,7 +274,7 @@ build_test:
   stage: container-test
   needs:
     - build_test
-  image: python:3.11-bookworm
+  image: $CI_REGISTRY_IMAGE/build_image:$CI_PIPELINE_ID
   variables:
     FF_NETWORK_PER_BUILD: 1
     POSTGRES_DB: image-test
@@ -303,33 +302,44 @@ build_test:
     - curl --max-time 8 --retry 3 --fail ${BASE_URL}/.well-known/version
     - curl --max-time 3 --retry 3 --fail ${BASE_URL}/.well-known/health
 
-test_image_api:
+test_backoffice:
   extends: .test_image
   variables:
-    SERVE_API: "yes"
     SERVE_BACKOFFICE: "yes"
+    BACKOFFICE_BASE_URL: /
   script:
-    # check that the profile can be queried
-    - curl --max-time 3 --retry 3 --fail ${BASE_URL}/api/me
-    # get a list of all conferences
-    - curl --max-time 3 --retry 3 --fail ${BASE_URL}/api/info
+    # check that the api is avilable
+    - curl --max-time 3 --retry 3 --fail ${BASE_URL}/
     # run integration tests
-    - cd tests
-    - python3 -m unittest -v
+    - pdm install -d --no-editable -G dev
+    - pdm run tox -e live-test
 
-test_image_frontend:
+test_api:
   extends: .test_image
   variables:
-    SERVE_FRONTEND: "yes"
     SERVE_API: "yes"
+    SERVE_BACKOFFICE: "no"
+    API_BASE_URL: /
+  script:
+    # check that the api is avilable
+    - curl --max-time 3 --retry 3 --fail ${BASE_URL}/
+    # run integration tests
+    - pdm install -d --no-editable -G dev
+    - pdm run tox -e live-test
+
+test_frontend:
+  extends: .test_image
+  variables:
+    SERVE_FRONTEND: "yes"
+    SERVE_API: "no"
     DJANGO_LOAD_FIXTURE: "core/fixtures/anhalter.json"
     SELECTED_CONFERENCE_ID: "017c0749-a2ea-4f86-92cd-e60b4508dd98"
   script:
-    # check that something is being served at all
+    # check that the plainui is being served
     - curl --max-time 3 --retry 3 --fail ${BASE_URL}/en/index
     # run integration tests
-    - cd tests
-    - python3 -m unittest -v
+    - pdm install -d --no-editable -G dev
+    - pdm run tox -e live-test
 
 test_nginx_static:
   extends:
@@ -352,8 +362,9 @@ test_nginx_static:
   stage: publish
   needs:
     - build_release
-    - test_image_frontend
-    - test_image_api
+    - test_backoffice
+    - test_frontend
+    - test_api
     - test_nginx_static
 
   image:
-- 
GitLab