-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
163 lines (153 loc) · 4.28 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
163 lines (153 loc) · 4.28 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# Docker Compose Configuration for Integration Testing
# Provides isolated test environment for integration tests
version: '3.8'
services:
# PostgreSQL Test Database
postgres-test:
image: postgres:15-alpine
container_name: ai-employee-platform-postgres-test
environment:
POSTGRES_DB: ai_platform_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: testpassword
POSTGRES_INITDB_ARGS: "--auth-host=md5"
ports:
- "5433:5432" # Different port to avoid conflicts
volumes:
- postgres_test_data:/var/lib/postgresql/data
- ./database/scripts:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d ai_platform_test"]
interval: 10s
timeout: 5s
retries: 5
networks:
- test-network
command: >
postgres -c log_statement=all
-c log_destination=stderr
-c log_min_messages=info
-c max_connections=200
-c shared_buffers=256MB
-c effective_cache_size=1GB
restart: unless-stopped
# Redis Test Instance
redis-test:
image: redis:7-alpine
container_name: ai-employee-platform-redis-test
ports:
- "6380:6379" # Different port to avoid conflicts
volumes:
- redis_test_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- test-network
command: >
redis-server --maxmemory 256mb
--maxmemory-policy allkeys-lru
--save 60 1
--loglevel notice
--databases 16
restart: unless-stopped
# Test Auth Service (for integration testing)
auth-service-test:
build:
context: ./services/auth-service
dockerfile: Dockerfile.dev
container_name: ai-employee-platform-auth-test
environment:
NODE_ENV: test
PORT: 3001
DATABASE_URL: postgresql://postgres:testpassword@postgres-test:5432/ai_platform_test
REDIS_URL: redis://redis-test:6379/1
JWT_SECRET: test-jwt-secret-key-super-long-and-secure
JWT_REFRESH_SECRET: test-jwt-refresh-secret-key-super-long-and-secure
BCRYPT_ROUNDS: 10
ports:
- "3001:3001"
volumes:
- ./services/auth-service/src:/app/src
- ./packages:/packages
- auth_test_logs:/app/logs
depends_on:
postgres-test:
condition: service_healthy
redis-test:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3001/health"]
interval: 30s
timeout: 10s
retries: 3
networks:
- test-network
restart: unless-stopped
# Test Data Seeder (runs once to populate test data)
test-seeder:
build:
context: ./database
dockerfile: Dockerfile
container_name: ai-employee-platform-test-seeder
environment:
NODE_ENV: test
DATABASE_URL: postgresql://postgres:testpassword@postgres-test:5432/ai_platform_test
volumes:
- ./database:/app
- ./tests/fixtures:/app/fixtures
depends_on:
postgres-test:
condition: service_healthy
networks:
- test-network
command: yarn seed:test
restart: "no"
# Mailhog (for email testing)
mailhog-test:
image: mailhog/mailhog:latest
container_name: ai-employee-platform-mailhog-test
ports:
- "1025:1025" # SMTP port
- "8025:8025" # Web UI port
networks:
- test-network
restart: unless-stopped
# Test File Storage
minio-test:
image: minio/minio:latest
container_name: ai-employee-platform-minio-test
environment:
MINIO_ROOT_USER: testuser
MINIO_ROOT_PASSWORD: testpassword123
ports:
- "9000:9000"
- "9001:9001"
volumes:
- minio_test_data:/data
networks:
- test-network
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 30s
timeout: 20s
retries: 3
restart: unless-stopped
volumes:
postgres_test_data:
driver: local
redis_test_data:
driver: local
auth_test_logs:
driver: local
minio_test_data:
driver: local
networks:
test-network:
driver: bridge
ipam:
config:
- subnet: 172.20.0.0/16