Files
siftlode/backend/docker-compose.test.yml
T
peter f2fe0fc0df build(gate)!: coverage leaves the gate and runs on demand
Both lanes printed a coverage total with no threshold (owner decision E32
D4). No real hit as a lane: the one time the number found anything (5 bugs,
E32) it was read by hand, and since then it was a line nobody acted on. It
was also the most expensive part of the vitest lane, and the run that
flaked in E35 S1. The vitest lane runs without --coverage, the pytest lane
runs plain pytest; docs/development.md gives both on-demand commands, and
the register row says why.
2026-10-05 00:19:39 +02:00

40 lines
1.6 KiB
YAML

# DB-backed pytest lane (R6 S3b): an ephemeral Postgres + the test image, wired together so the
# `db` fixture (tests/conftest.py) has a real database. The whole thing is throwaway — the pg data
# lives in tmpfs (RAM) and nothing is persisted. The pure-logic lane still runs WITHOUT this file
# (plain `docker run … python -m pytest` — DB tests skip when no Postgres is reachable).
#
# docker compose -f backend/docker-compose.test.yml up --build --abort-on-container-exit \
# --exit-code-from test
# docker compose -f backend/docker-compose.test.yml down -v
services:
testdb:
image: postgres:16-alpine
environment:
POSTGRES_USER: siftlode
POSTGRES_PASSWORD: siftlode
POSTGRES_DB: siftlode_test
tmpfs:
- /var/lib/postgresql/data # ephemeral + fast; the schema is rebuilt per run
healthcheck:
test: ["CMD-SHELL", "pg_isready -U siftlode -d siftlode_test"]
interval: 1s
timeout: 3s
retries: 30
test:
build:
context: .
dockerfile: Dockerfile.test
depends_on:
testdb:
condition: service_healthy
environment:
DATABASE_URL: postgresql+psycopg://siftlode:siftlode@testdb:5432/siftlode_test
# This lane HAS a Postgres + ffmpeg, so the DB/ffmpeg tests must actually run here: conftest turns
# a would-be silent skip into a hard failure (SIFTLODE_TEST_REQUIRE_DB).
SIFTLODE_TEST_REQUIRE_DB: "1"
volumes:
- ./:/app
working_dir: /app
# Coverage is on demand, not in the gate (E35): see docs/development.md.
command: ["python", "-m", "pytest"]