# docker-compose.test.yml - Test environment
# Used by: TestContainerManager (automated) or manual `docker compose -f docker-compose.test.yml up`
#
# This file is the SINGLE SOURCE OF TRUTH for test container configuration.
# All values use environment variable substitution from .env files.
# No persistent volumes - tests start fresh each run.
#
# Requirements: 15.2, 16.2, 16.4, 16.5, 17.2
services:
postgres-test:
image: pgvector/pgvector:pg16
container_name: ${TEST_CONTAINER_PREFIX:-thoughtmcp-test}-postgres
environment:
POSTGRES_USER: ${TEST_DB_USER:-thoughtmcp_test}
POSTGRES_PASSWORD: ${TEST_DB_PASSWORD:-test_password}
POSTGRES_DB: ${TEST_DB_NAME:-thoughtmcp_test}
POSTGRES_INITDB_ARGS: "-E UTF8"
ports:
- "${TEST_DB_PORT:-5433}:5432"
volumes:
# Initialize database with schema (no persistent volumes for tests)
- ./scripts/db/init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
- ./scripts/db/enable-pgvector.sql:/docker-entrypoint-initdb.d/02-enable-pgvector.sql:ro
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${TEST_DB_USER:-thoughtmcp_test} -d ${TEST_DB_NAME:-thoughtmcp_test}",
]
interval: 5s
timeout: 3s
retries: 10
start_period: 5s
networks:
- thoughtmcp-test
ollama-test:
image: ollama/ollama:latest
container_name: ${TEST_CONTAINER_PREFIX:-thoughtmcp-test}-ollama
ports:
- "${TEST_OLLAMA_PORT:-11435}:11434"
healthcheck:
# Use ollama list instead of curl since curl is not available in the ollama image
test: ["CMD", "ollama", "list"]
interval: 5s
timeout: 10s
retries: 15
start_period: 10s
networks:
- thoughtmcp-test
networks:
thoughtmcp-test:
driver: bridge