From 51504f8a6f10c8961284a93a840f7c428d87c73a Mon Sep 17 00:00:00 2001 From: Stefan Saenger Date: Wed, 15 Jul 2026 14:03:27 +0200 Subject: [PATCH] fix: correct pytest paths for tester container The tester container uses WORKDIR /tests, so 'tests/pytest.ini' resolves to /tests/tests/pytest.ini which does not exist, causing FileNotFoundError in CI. Use paths relative to /tests (pytest . -c pytest.ini) for all in-container invocations: CI job, Makefile target, tester image CMD, and docs. Host-run scripts are unchanged (they run from repo root). Part-of: --- .gitlab-ci.yml | 2 +- AGENTS.md | 2 +- Makefile | 2 +- docker-compose.yml | 2 +- tests/Dockerfile | 2 +- tests/README.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ff5df9..0550c73 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -46,7 +46,7 @@ test:compose: # Run the slixmpp suite inside the compose network via the prebuilt tester # image (deps + env vars already wired in docker-compose.yml). The ./tests # volume mount surfaces report.xml on the runner for the junit artifact. - - docker compose --profile ci run --rm tester pytest tests/ -v -c tests/pytest.ini --junitxml=report.xml + - docker compose --profile ci run --rm tester pytest . -v -c pytest.ini --junitxml=report.xml after_script: - docker compose down -v || true artifacts: diff --git a/AGENTS.md b/AGENTS.md index 02880a1..97cd7d2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -13,7 +13,7 @@ Dockerized Prosody **13.0.6** XMPP server for VNCtalk, built against **Lua 5.4** - **Docker-compose test harness** (`docker-compose.yml`): postgres + an aiohttp mock (stands in for auth/FCM/file-share/avatar backends) + prosody. Convenience wrappers in the `Makefile`: - `make up` — build + start postgres/mocks/prosody (run pytest from host against published ports). - `make down` / `make logs`. - - `make test` runs the suite in the `tester` service, but `tester` is gated behind the `ci` profile (`profiles: ["ci"]`) — invoke as `docker compose --profile ci run --rm tester pytest tests/ -v -c tests/pytest.ini`. Easier: use `run-compose-tests.sh` (see below). + - `make test` runs the suite in the `tester` service, but `tester` is gated behind the `ci` profile (`profiles: ["ci"]`) — invoke as `docker compose --profile ci run --rm tester pytest . -v -c pytest.ini`. Easier: use `run-compose-tests.sh` (see below). - **`run-compose-tests.sh`** is the recommended one-shot runner: creates `tests/venv`, brings up the stack, waits for prosody health, and runs the full suite from the host with all env vars set. Flags: `--no-down` (leave stack up), `--down` (tear down only). It auto-remaps telnet to 5583 if 5582 is taken (e.g. by a stale kubectl port-forward). - **`run-tests.sh` / `run-all-tests.sh`** target an **external microlab deployment** (hardcoded hosts/creds), not the compose harness. They require an SSH tunnel to PostgreSQL (`ssh -p 60024 … -L 14322:127.0.0.1:5432`) and a `kubectl port-forward services/telnet 5582:5582 -n prosody`. Not for local image testing. - `test.sh` is a **manual smoke test**: `./test.sh ` runs the image with example env vars. Not automated. diff --git a/Makefile b/Makefile index e702477..f353a93 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ up: docker compose up -d --build postgres mocks prosody test: up - docker compose run --rm --rm tester pytest tests/ -v -c tests/pytest.ini + docker compose run --rm --rm tester pytest . -v -c pytest.ini down: docker compose down diff --git a/docker-compose.yml b/docker-compose.yml index 24703e0..866f59f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ # host can run pytest directly against the published ports. # # docker compose up -d --build postgres mocks prosody -# docker compose run --rm tester pytest tests/ -v -c tests/pytest.ini +# docker compose run --rm tester pytest . -v -c pytest.ini # # Env-var names below use the EXACT placeholders found in # config/prosody.cfg.lua.template (snake_case ${fcm_api_url} / ${del_api_url}). diff --git a/tests/Dockerfile b/tests/Dockerfile index dd71ef7..e4e4a40 100644 --- a/tests/Dockerfile +++ b/tests/Dockerfile @@ -4,4 +4,4 @@ COPY requirements.txt /tests/requirements.txt RUN apk add --no-cache build-base libffi-dev openssl-dev libxml2-dev libxslt-dev \ && pip install --no-cache-dir -r requirements.txt COPY . /tests -CMD ["pytest", "tests/", "-v", "-c", "tests/pytest.ini"] +CMD ["pytest", ".", "-v", "-c", "pytest.ini"] diff --git a/tests/README.md b/tests/README.md index 5543a44..6a86160 100644 --- a/tests/README.md +++ b/tests/README.md @@ -154,7 +154,7 @@ and admin-only paths). make test # equivalent to: # docker compose up -d --build postgres mocks prosody -# docker compose run --rm tester pytest tests/ -v -c tests/pytest.ini +# docker compose run --rm tester pytest . -v -c pytest.ini ``` The `tester` service is gated behind the `ci` profile, so it only starts when