-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
116 lines (110 loc) · 3.03 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
116 lines (110 loc) · 3.03 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
109
110
111
112
113
114
115
116
version: '3.8'
networks:
fuzekeys-test:
driver: bridge
services:
# PostgreSQL Database for testing
fuzekeys-db-test:
image: postgres:15
container_name: fuzekeys-db-test
environment:
- POSTGRES_DB=fuzekeys_test
- POSTGRES_USER=fuzekeys_user
- POSTGRES_PASSWORD=fuzekeys_password
ports:
- "5433:5432"
networks:
- fuzekeys-test
volumes:
- postgres_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fuzekeys_user -d fuzekeys_test"]
interval: 10s
timeout: 5s
retries: 5
# FuzeKeys Backend API
fuzekeys-backend-test:
build:
context: ./backend
dockerfile: Dockerfile
container_name: fuzekeys-backend-test
environment:
- DATABASE_URL=postgresql+asyncpg://fuzekeys_user:fuzekeys_password@fuzekeys-db-test:5432/fuzekeys_test
- SECRET_KEY=test-secret-key
- MASTER_KEY_SALT=test-salt
- ENVIRONMENT=test
- PYTHONPATH=/app
ports:
- "8003:8002"
networks:
- fuzekeys-test
depends_on:
fuzekeys-db-test:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8002/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
labels:
- "com.docker.compose.project=FuzeKeys-Test"
command: >
sh -c "
echo '🔧 Initializing database...' &&
python init_test_db.py &&
echo '🚀 Starting backend server...' &&
python -m uvicorn app.main:app --host 0.0.0.0 --port 8002
"
# FuzeKeys Frontend (React) - Test Configuration
fuzekeys-frontend-test:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- REACT_APP_API_URL=http://localhost:8003
container_name: fuzekeys-frontend-test
environment:
- REACT_APP_API_URL=http://localhost:8003
- NODE_ENV=production
depends_on:
fuzekeys-backend-test:
condition: service_healthy
ports:
- "3006:3000"
networks:
- fuzekeys-test
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
labels:
- "com.docker.compose.project=FuzeKeys-Test"
# Test Runner Service
fuzekeys-test-runner:
build:
context: ./frontend
dockerfile: Dockerfile.test
container_name: fuzekeys-test-runner
environment:
- CI=true
- REACT_APP_API_URL=http://fuzekeys-backend-test:8002
networks:
- fuzekeys-test
depends_on:
fuzekeys-frontend-test:
condition: service_healthy
fuzekeys-backend-test:
condition: service_healthy
volumes:
- ./frontend/src:/app/src:ro
- ./frontend/public:/app/public:ro
- test_results:/app/test-results
command: npm test -- --testPathPattern=SitesDatabase --watchAll=false --coverage --coverageDirectory=test-results
volumes:
postgres_test_data:
test_results: