-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
97 lines (88 loc) · 2.62 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
97 lines (88 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# =============================================================================
# Test Stack Overrides
# =============================================================================
#
# Self-contained test stack for running backend integration tests.
# Uses ephemeral volumes, reduced resources, and test-specific config.
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.test.yml up -d
# make test-integration-full
# docker compose -f docker-compose.yml -f docker-compose.test.yml down -v
#
# What this changes vs production:
# - Ephemeral PostgreSQL (tmpfs — no persistent data)
# - Test-specific SECRET_KEY
# - Single Celery worker (reduced concurrency)
# - No celery-beat (no scheduled tasks during tests)
# - No postgres-backup (not needed for tests)
# - No frontend build (tests hit API directly)
# - Backend mounts test directory
# - Reduced resource limits
#
services:
postgres:
# Use tmpfs for ephemeral test database (fast, no disk writes)
tmpfs:
- /var/lib/postgresql/data
environment:
POSTGRES_DB: bnk_forge_test
POSTGRES_USER: bnk
POSTGRES_PASSWORD: bnk_test
redis:
# Use default config, no persistence needed
command: redis-server --save "" --appendonly no
backend:
environment:
DATABASE_URL: "postgresql://bnk:bnk_test@postgres:5432/bnk_forge_test"
SECRET_KEY: "test-secret-key-do-not-use-in-production"
REDIS_URL: "redis://redis:6379/0"
# Seed admin user on startup
SEED_ADMIN: "true"
ADMIN_USERNAME: "admin"
ADMIN_PASSWORD: "admin"
# Test mode flags
TESTING: "true"
LOG_LEVEL: "WARNING"
volumes:
# Mount tests for in-container test execution
- ./backend/tests:/app/tests:ro
- ./backend/pyproject.toml:/app/pyproject.toml:ro
deploy:
resources:
limits:
cpus: '2'
memory: 1G
celery-worker:
environment:
DATABASE_URL: "postgresql://bnk:bnk_test@postgres:5432/bnk_forge_test"
SECRET_KEY: "test-secret-key-do-not-use-in-production"
REDIS_URL: "redis://redis:6379/0"
LOG_LEVEL: "WARNING"
# Single worker with reduced concurrency
command: >
celery -A celery_app worker
--loglevel=warning
--concurrency=2
--queues=default,k8s
deploy:
resources:
limits:
cpus: '1'
memory: 512M
# Disable services not needed for testing
celery-worker-2:
profiles:
- disabled
celery-beat:
profiles:
- disabled
postgres-backup:
profiles:
- disabled
frontend:
profiles:
- disabled
proxy:
profiles:
- disabled