# Test-only infrastructure for integration tests. # # Mirrors the real infra (postgres + redis + rabbitmq + minio) but uses # dedicated container names and host ports so it can coexist with the # development stack (`docker-compose.yml`). Nothing in this file runs # application services — only the data stores required by # tests/integration/conftest.py. # # Usage: # docker compose -f docker-compose.test.yml up -d --wait # uv run pytest -m integration # docker compose -f docker-compose.test.yml down -v # # The conftest.py fixture `infra` brings this file up automatically before the # first integration test and tears it down after the session. services: postgres-test: image: postgres:18-alpine restart: "no" command: - "postgres" - "-c" - "wal_level=replica" - "-c" - "archive_mode=on" - "-c" - "archive_command=test ! -f /walarchive/%f && cp %p /walarchive/%f" environment: POSTGRES_USER: contract_check POSTGRES_PASSWORD: contract_check POSTGRES_DB: contract_check volumes: - pgdata-test:/var/lib/postgresql - pgwal-test:/walarchive ports: - "25432:5432" healthcheck: test: - CMD-SHELL - "pg_isready -U contract_check -d contract_check" interval: 5s timeout: 3s retries: 10 redis-test: image: redis:8-alpine restart: "no" command: ["redis-server", "--appendonly", "yes"] volumes: - redisdata-test:/data ports: - "27379:6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 5s timeout: 3s retries: 10 rabbitmq-test: image: rabbitmq:4-management-alpine restart: "no" environment: RABBITMQ_DEFAULT_USER: contract_check RABBITMQ_DEFAULT_PASS: contract_check RABBITMQ_DEFAULT_VHOST: / volumes: - rabbitmq-test:/var/lib/rabbitmq ports: - "6672:5672" # AMQP - "25672:15672" # management UI (http://localhost:25672) healthcheck: test: ["CMD", "rabbitmq-diagnostics", "-q", "ping"] interval: 10s timeout: 5s retries: 10 start_period: 15s minio-test: image: minio/minio:latest restart: "no" command: server /data --console-address ":9001" environment: MINIO_ROOT_USER: contract_check MINIO_ROOT_PASSWORD: contract_check volumes: - minio-test:/data ports: - "10000:9000" # S3 API - "10001:9001" # console (http://localhost:10001) healthcheck: test: ["CMD", "curl", "-sf", "http://localhost:9000/minio/health/ready"] interval: 10s timeout: 5s retries: 10 start_period: 10s minio-init-test: image: minio/mc:latest depends_on: minio-test: condition: service_healthy entrypoint: /bin/sh command: - -c - | set -e mc alias set local http://minio-test:9000 contract_check contract_check mc mb --ignore-existing local/contract-check-docs-test mc anonymous set none local/contract-check-docs-test || true mc ilm rule add --expire-days 7 local/contract-check-docs-test || true echo "bucket contract-check-docs-test ready" environment: MINIO_ROOT_USER: contract_check MINIO_ROOT_PASSWORD: contract_check restart: "no" volumes: pgdata-test: pgwal-test: redisdata-test: rabbitmq-test: minio-test: