| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- # Test-only shared services for the compose-first integration harness.
- #
- # Starts ONE Postgres + ONE Redis shared by every test process. Per-test
- # isolation comes from the harness itself (fresh `CREATE DATABASE` per test,
- # unique Redis key prefixes per test) — never from per-test containers, and
- # never via FLUSHALL/FLUSHDB (nextest runs tests in parallel processes).
- #
- # Credentials and ports match the harness defaults exactly
- # (`D_OAUTH_TEST_POSTGRES_URL` / `D_OAUTH_TEST_REDIS_URL` overrides in
- # `tests/common/mod.rs`):
- #
- # docker compose -f compose.test.yaml up -d
- # cargo nextest run -E 'test(migration_users_creates_schema_and_second_run_is_noop)'
- # docker compose -f compose.test.yaml down -v
- #
- # Ports 5433/6380 avoid clashing with a developer's local 5432/6379.
- # This file is test-only; the local proof deployment stays in `compose.yaml`.
- #
- # `testcontainers` remains only for suites that need Redis nodes of their own:
- # the stop/start lifecycle, Sentinel/Cluster topology, the `--appendfsync always`
- # durability suites, and the private-container Redis flush test. Every other
- # unit and integration suite uses these shared services.
- #
- # `test-db` runs with `max_connections=500`: the shared server now backs many
- # parallel per-suite databases (one nextest process per CPU, each test holding
- # a max-4 pool), so the default 100 is too low. 500 is the floor for high-core
- # CI; hosts above ~125 logical CPUs need `max(500, 4*nproc + margin)`.
- #
- # The same concentration raised aggregate Postgres parallel-worker DSM
- # pressure: the Docker `/dev/shm` default is 64 MB and hit 95% full,
- # producing `could not resize shared memory segment` (SQLSTATE 53100) flakes.
- # So `shm_size` is pinned to 1 GB and parallel gather is disabled
- # (`max_parallel_workers_per_gather=0`); a test server does not need parallel
- # query, and this removes the DSM/`/dev/shm` allocation entirely.
- name: d-oauth-test
- services:
- test-db:
- image: postgres:18-alpine
- command: ["postgres", "-c", "max_connections=500", "-c", "max_parallel_workers_per_gather=0"]
- shm_size: 1gb
- environment:
- POSTGRES_PASSWORD: oauth-test-only
- ports:
- - "5433:5432"
- healthcheck:
- test: ["CMD-SHELL", "pg_isready -U postgres"]
- interval: 5s
- timeout: 3s
- retries: 20
- test-redis:
- image: redis:8-alpine
- # Mirrors the server's durability contract: AOF on, eviction off.
- command: ["redis-server", "--appendonly", "yes", "--maxmemory-policy", "noeviction"]
- ports:
- - "6380:6379"
- healthcheck:
- test: ["CMD", "redis-cli", "ping"]
- interval: 5s
- timeout: 3s
- retries: 20
|