From 6611c5db9796d92cf8dcbe59ff16f88fbfa302fc Mon Sep 17 00:00:00 2001 From: Sebastian Krupinski Date: Thu, 23 Jul 2026 00:18:35 -0400 Subject: [PATCH] fis: databsee test Signed-off-by: Sebastian Krupinski --- .github/workflows/test.yml | 8 +++++--- README.md | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b6e12b6..7170fad 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,6 +11,7 @@ env: TEST_SERVER_REPOSITORY: ${{ vars.TEST_SERVER_REPOSITORY || 'Nodarx/server' }} TEST_SERVER_REF: ${{ vars.TEST_SERVER_REF || 'main' }} TEST_GIT_SERVER_URL: ${{ vars.TEST_GIT_SERVER_URL || 'https://git.ktrix.dev' }} + TEST_DATABASE_URI: ${{ vars.TEST_DATABASE_URI || 'mongodb://mongo:27017/?tls=false' }} jobs: test-node: @@ -91,7 +92,7 @@ jobs: install-php: 'true' php-version: '8.5' server-path: './test-server' - database-uri: 'mongodb://127.0.0.1:27017/?tls=false' + database-uri: ${{ env.TEST_DATABASE_URI }} database-name: 'ktrix_ci' app-environment: 'test' server-repository: ${{ env.TEST_SERVER_REPOSITORY }} @@ -107,7 +108,8 @@ jobs: $uri = $config["database"]["uri"] ?? null; $name = $config["database"]["database"] ?? null; $env = $config["environment"] ?? null; - if ($uri !== "mongodb://127.0.0.1:27017/?tls=false") { fwrite(STDERR, "database.uri not overridden, got: $uri\n"); exit(1); } + $expectedUri = getenv("TEST_DATABASE_URI"); + if ($uri !== $expectedUri) { fwrite(STDERR, "database.uri not overridden, got: $uri\n"); exit(1); } if ($name !== "ktrix_ci") { fwrite(STDERR, "database.database not overridden, got: $name\n"); exit(1); } if ($env !== "test") { fwrite(STDERR, "environment not overridden, got: $env\n"); exit(1); } ' @@ -135,7 +137,7 @@ jobs: install-php: 'true' php-version: '8.5' server-path: './test-server' - database-uri: 'mongodb://127.0.0.1:27017/?tls=false' + database-uri: ${{ env.TEST_DATABASE_URI }} database-name: 'ktrix_ci' install-base-modules: 'true' server-repository: ${{ env.TEST_SERVER_REPOSITORY }} diff --git a/README.md b/README.md index ef1cfee..fe5389c 100644 --- a/README.md +++ b/README.md @@ -246,10 +246,18 @@ To test another source without editing the workflow, set: | `TEST_SERVER_REPOSITORY` | Repository in `owner/name` form | `Nodarx/server` | | `TEST_SERVER_REF` | Branch, tag, or commit | `main` | | `TEST_GIT_SERVER_URL` | Base URL of the GitHub-compatible server | `https://git.ktrix.dev` | +| `TEST_DATABASE_URI` | MongoDB service URI used by database tests | `mongodb://mongo:27017/?tls=false` | For a private source, also add a repository secret named `TEST_SERVER_TOKEN`. Public repositories do not require the secret. +Gitea Actions runs the job and service containers separately. Workflows that +declare a MongoDB service named `mongo` must therefore pass +`database-uri: mongodb://mongo:27017/?tls=false`; `127.0.0.1` points to the job +container, not the MongoDB service. On runner setups where services are +published directly onto the host, override `TEST_DATABASE_URI` with the +appropriate host address. + ## Outputs | Output | Description |