-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
69 lines (66 loc) · 2.82 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
69 lines (66 loc) · 2.82 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
# Test Docker Compose - Ephemeral services for integration testing
# Usage: docker compose -f docker-compose.test.yml up -d
# Cleanup: docker compose -f docker-compose.test.yml down -v
#
# Concurrent worktrees (#3066): the BREEZE_TEST_* variables below let
# `pnpm test-stack up` (scripts/dev/test-stack) run a PRIVATE copy of this
# stack per git worktree — its own compose project, ephemeral host ports, and
# per-project container/network names — so two sessions never TRUNCATE each
# other's database. Every variable defaults to the historical fixed value, so
# plain `docker compose -f docker-compose.test.yml up -d` (CI, single-session
# local) behaves exactly as before.
services:
# PostgreSQL Database for Tests
postgres-test:
# pgvector/pgvector is the official postgres image + the vector extension
# (drop-in superset of postgres:16).
image: pgvector/pgvector:pg16
container_name: ${BREEZE_TEST_PG_CONTAINER:-breeze-postgres-test}
# Durability is pointless for a throwaway tmpfs test DB, and the
# integration suite's per-test TRUNCATE ... CASCADE makes thousands of
# commits per run — fsync/synchronous_commit off keeps unattended local
# runs from crawling (and does nothing worse than lose data we delete
# on `down -v` anyway).
command: postgres -c fsync=off -c synchronous_commit=off -c full_page_writes=off
environment:
POSTGRES_USER: breeze_test
POSTGRES_PASSWORD: breeze_test
POSTGRES_DB: breeze_test
ports:
# Different port to avoid conflicts with dev. `pnpm test-stack` passes 0
# to get an ephemeral host port for per-worktree isolation.
- "${BREEZE_TEST_PG_PORT:-5433}:5432"
tmpfs:
- /var/lib/postgresql/data # Use tmpfs for speed, data is ephemeral
networks:
- breeze-test-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U breeze_test -d breeze_test"]
interval: 2s
timeout: 5s
retries: 10
start_period: 2s
# Redis for Tests
redis-test:
image: redis:7-alpine
container_name: ${BREEZE_TEST_REDIS_CONTAINER:-breeze-redis-test}
command: redis-server --appendonly no --save "" # No persistence for speed
ports:
# Different port to avoid conflicts with dev. `pnpm test-stack` passes 0
# to get an ephemeral host port for per-worktree isolation.
- "${BREEZE_TEST_REDIS_PORT:-6380}:6379"
networks:
- breeze-test-network
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 5s
retries: 10
start_period: 1s
networks:
breeze-test-network:
driver: bridge
# Must be unique per compose project: docker refuses to reuse a named
# network created by a different project ("incorrect label" error), so
# `pnpm test-stack` derives a per-project name here.
name: ${BREEZE_TEST_NETWORK:-breeze-test-network}