From 7f8aed91c3ee1259534e7eee035395e17f9c91d9 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Thu, 16 Jan 2025 09:43:04 +0000
Subject: [PATCH] Run ci-test with actual data

---
 .gitlab-ci.yml          |  9 ++++++++-
 docker/test-config.json | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 docker/test-config.json

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1072abdc..6328b582 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,12 +4,19 @@ include: "https://git.autistici.org/pipelines/containers/raw/master/common.yml"
 test:
   stage: container-test
   image: registry.git.autistici.org/pipelines/images/test/float-podman-runner:master
+  services:
+    - docker.io/library/mysql:latest
   tags: [podman]
   variables:
     APACHE_PORT: 8080
     SITE_URL: "http://localhost:8080"
+    MYSQL_DATABASE: noblogs
+    MYSQL_ROOT_PASSWORD: rootpass
   before_script:
     - echo -n "$CI_JOB_TOKEN" | podman login -u gitlab-ci-token --password-stdin $CI_REGISTRY
   script:
-    - with-container --expose=8080 $IMAGE_TAG ./docker/test.sh
+    - DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends mysql-client xz-utils git
+    - git clone --depth=1 https://gitlab-ci-token:${CI_JOB_TOKEN}/ai3/testdata.git /tmp/testdata.$CI_JOB_ID
+    - xz -d /tmp/testdata.$CI_JOB_ID/noblogs/noblogs.sql.xz | mysql --user=root --password=rootpass --host=mysql noblogs
+    - with-container --expose=8080 --mount=type=bind,source=docker/test-config.json,destination=/etc/noblogs/config.json $IMAGE_TAG ./docker/test.sh
 
diff --git a/docker/test-config.json b/docker/test-config.json
new file mode 100644
index 00000000..85e4eb81
--- /dev/null
+++ b/docker/test-config.json
@@ -0,0 +1,34 @@
+{
+  "secrets": {
+    "auth_key": "be51a7fb3f4c3924c3a351a834ae605f",
+    "secure_auth_key": "be51a7fb3f4c3924c3a351a834ae605f",
+    "logged_in_key": "be51a7fb3f4c3924c3a351a834ae605f",
+    "nonce_key": "be51a7fb3f4c3924c3a351a834ae605f",
+    "auth_salt": "be51a7fb3f4c3924c3a351a834ae605f",
+    "secure_auth_salt": "be51a7fb3f4c3924c3a351a834ae605f",
+    "logged_in_salt": "be51a7fb3f4c3924c3a351a834ae605f",
+    "nonce_salt": "be51a7fb3f4c3924c3a351a834ae605f"
+  },
+  "db_config": {
+    "backends": {
+      "backend_1": {
+        "host": "mysql",
+        "port": 3306,
+        "user": "root",
+        "password": "rootpass",
+        "name": "noblogs"
+      }
+    },
+    "is_master": true,
+    "master": {
+      "host": "mysql",
+      "port": 3306,
+      "user": "root",
+      "password": "rootpass",
+      "name": "noblogs"
+    }
+  },
+  "debug": false,
+  "debug_cookie_name": "__unused__",
+  "local_backend_name": "backend_1"
+}
-- 
GitLab