forked from 99techteam/code-challenge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
124 lines (117 loc) · 2.7 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
124 lines (117 loc) · 2.7 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
117
118
119
120
121
122
123
124
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_DB: problem5_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- "5433:5432" # Use different port for tests
volumes:
- postgres_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
networks:
- test-network
redis:
image: redis:7-alpine
ports:
- "6380:6379" # Use different port for tests
volumes:
- redis_test_data:/data
command: redis-server --appendonly yes
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
networks:
- test-network
app:
build: .
ports:
- "3001:3000" # Use different port for tests
environment:
- NODE_ENV=test
- DATABASE_URL=postgresql://postgres:password@postgres:5432/problem5_test
- USE_REDIS=true
- REDIS_HOST=redis
- PORT=3000
- JWT_SECRET=test-jwt-secret-for-e2e-testing
- BCRYPT_ROUNDS=10
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- .:/app
- /app/node_modules
command: npm start
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 10s
timeout: 5s
retries: 5
networks:
- test-network
load-test:
build: .
environment:
- NODE_ENV=test
- TEST_BASE_URL=http://app:3000
depends_on:
app:
condition: service_healthy
volumes:
- .:/app
- /app/node_modules
command: npm run test:load:internal
profiles:
- load
networks:
- test-network
k6-load-test:
image: grafana/k6:latest
environment:
- BASE_URL=http://app:3000
volumes:
- ./scripts/load-test-k6.js:/scripts/load-test-k6.js
command: run /scripts/load-test-k6.js
depends_on:
app:
condition: service_healthy
profiles:
- k6
networks:
- test-network
e2e-tests:
build: .
environment:
- NODE_ENV=test
- DATABASE_URL=postgresql://postgres:password@postgres:5432/problem5_test
- USE_REDIS=true
- REDIS_HOST=redis
- TEST_BASE_URL=http://app:3000
- PORT=3000
- JWT_SECRET=test-jwt-secret-for-e2e-testing
- BCRYPT_ROUNDS=10
depends_on:
app:
condition: service_healthy
volumes:
- .:/app
- /app/node_modules
command: npm run test:e2e
profiles:
- test
networks:
- test-network
networks:
test-network:
volumes:
postgres_test_data:
redis_test_data: