-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
108 lines (103 loc) · 3.01 KB
/
docker-compose.test.yml
File metadata and controls
108 lines (103 loc) · 3.01 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
98
99
100
101
102
103
104
105
106
107
108
# Docker Compose configuration for VISTA testing environment
# Uses ephemeral storage (tmpfs) for fast, isolated test execution
# Usage: docker compose -f docker-compose.test.yml run --rm backend-test
services:
# PostgreSQL for testing (ephemeral)
postgres:
image: postgres:15
container_name: vista_postgres_test
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres_test
tmpfs:
- /var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
networks:
- vista-test
# MinIO for testing (ephemeral)
minio:
image: minio/minio:latest
container_name: vista_minio_test
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadminpassword
command: server /data
tmpfs:
- /data
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 5s
timeout: 5s
retries: 5
networks:
- vista-test
# Backend test runner
backend-test:
build:
context: .
dockerfile: Dockerfile.dev
target: backend-dev
environment:
- DATABASE_URL=postgresql+asyncpg://postgres:postgres@postgres:5432/postgres_test
- POSTGRES_SERVER=postgres
- POSTGRES_PORT=5432
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=postgres_test
- S3_ENDPOINT=minio:9000
- S3_ACCESS_KEY=minioadmin
- S3_SECRET_KEY=minioadminpassword
- S3_BUCKET=data-storage
- S3_USE_SSL=false
- FAST_TEST_MODE=true
- SKIP_HEADER_CHECK=true
- DEBUG=false
- PYTHONUNBUFFERED=1
- DISABLE_FILE_LOGGING=true
depends_on:
postgres:
condition: service_healthy
minio:
condition: service_healthy
volumes:
- ./backend:/app/backend:ro
- ./test:/app/test:ro
- ./pyproject.toml:/app/pyproject.toml:ro
- ./uv.lock:/app/uv.lock:ro
working_dir: /app/backend
command: >
bash -c "
echo 'Syncing dependencies...' &&
cd /app && uv sync --frozen --no-install-project && cd /app/backend &&
echo 'Running database migrations...' &&
alembic upgrade head &&
echo 'Running backend tests...' &&
pytest tests/ -v
"
networks:
- vista-test
# Frontend test runner
frontend-test:
build:
context: .
dockerfile: Dockerfile.dev
target: frontend-dev
volumes:
- ./frontend/src:/app/frontend/src:ro
- ./frontend/public:/app/frontend/public:ro
- ./frontend/package.json:/app/frontend/package.json:ro
- ./frontend/package-lock.json:/app/frontend/package-lock.json:ro
working_dir: /app/frontend
environment:
- CI=true
command: npm test -- --watchAll=false
networks:
- vista-test
networks:
vista-test:
driver: bridge