-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
202 lines (185 loc) · 5.03 KB
/
docker-compose.test.yml
File metadata and controls
202 lines (185 loc) · 5.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
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# Agent Relay Cloud - Full QA Test Environment
# Run with: docker compose -f docker-compose.test.yml up --build
#
# This environment simulates the full cloud stack with:
# - PostgreSQL database
# - Redis for sessions/pub-sub
# - Cloud API server
# - Simulated daemon(s) that report metrics
# - Test runner for integration tests
#
# Usage:
# # Start the full stack
# docker compose -f docker-compose.test.yml up -d
#
# # Run integration tests
# docker compose -f docker-compose.test.yml run test-runner
#
# # View logs
# docker compose -f docker-compose.test.yml logs -f
#
# # Tear down
# docker compose -f docker-compose.test.yml down -v
version: '3.8'
services:
# PostgreSQL database
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: agent_relay
POSTGRES_PASSWORD: test_password
POSTGRES_DB: agent_relay_test
ports:
- "5433:5432"
volumes:
- postgres_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U agent_relay"]
interval: 2s
timeout: 5s
retries: 10
# Redis for sessions and pub/sub
redis:
image: redis:7-alpine
ports:
- "6380:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 5s
retries: 10
# Cloud API server
cloud:
build:
context: .
dockerfile: Dockerfile
ports:
- "3100:3000"
environment:
NODE_ENV: test
PORT: 3000
PUBLIC_URL: http://localhost:3100
# Database
DATABASE_URL: postgres://agent_relay:test_password@postgres:5432/agent_relay_test
REDIS_URL: redis://redis:6379
# Session
SESSION_SECRET: test-session-secret
# Vault master key (test only) - "test-vault-key-32-bytes-testing!" = 32 bytes
VAULT_MASTER_KEY: dGVzdC12YXVsdC1rZXktMzItYnl0ZXMtdGVzdGluZyE=
# Disable external services in test mode
STRIPE_SECRET_KEY: sk_test_placeholder
STRIPE_PUBLISHABLE_KEY: pk_test_placeholder
STRIPE_WEBHOOK_SECRET: whsec_test
# Compute provider (docker for local)
COMPUTE_PROVIDER: docker
# Enable memory monitoring
RELAY_MEMORY_MONITORING: "true"
RELAY_CLOUD_ENABLED: "true"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
volumes:
- /var/run/docker.sock:/var/run/docker.sock
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:3000/health"]
interval: 5s
timeout: 5s
retries: 10
# Simulated daemon 1 - Reports metrics to cloud
daemon-simulator-1:
build:
context: .
dockerfile: test/cloud/Dockerfile.daemon-simulator
environment:
DAEMON_NAME: test-daemon-1
CLOUD_API_URL: http://cloud:3000
SIMULATOR_MODE: "true"
AGENT_COUNT: "3"
REPORT_INTERVAL_MS: "5000"
# Simulate some memory issues
SIMULATE_MEMORY_GROWTH: "true"
SIMULATE_CRASH: "false"
depends_on:
cloud:
condition: service_healthy
restart: on-failure
# Simulated daemon 2 - Normal operation
daemon-simulator-2:
build:
context: .
dockerfile: test/cloud/Dockerfile.daemon-simulator
environment:
DAEMON_NAME: test-daemon-2
CLOUD_API_URL: http://cloud:3000
SIMULATOR_MODE: "true"
AGENT_COUNT: "2"
REPORT_INTERVAL_MS: "5000"
SIMULATE_MEMORY_GROWTH: "false"
SIMULATE_CRASH: "false"
depends_on:
cloud:
condition: service_healthy
restart: on-failure
# Simulated daemon 3 - Crash simulation
daemon-simulator-crash:
build:
context: .
dockerfile: test/cloud/Dockerfile.daemon-simulator
environment:
DAEMON_NAME: test-daemon-crash
CLOUD_API_URL: http://cloud:3000
SIMULATOR_MODE: "true"
AGENT_COUNT: "1"
REPORT_INTERVAL_MS: "3000"
SIMULATE_MEMORY_GROWTH: "false"
SIMULATE_CRASH: "true"
CRASH_AFTER_SECONDS: "30"
depends_on:
cloud:
condition: service_healthy
profiles:
- crash-test
# Integration test runner
test-runner:
build:
context: .
dockerfile: test/cloud/Dockerfile.test-runner
environment:
CLOUD_API_URL: http://cloud:3000
DATABASE_URL: postgres://agent_relay:test_password@postgres:5432/agent_relay_test
REDIS_URL: redis://redis:6379
TEST_TIMEOUT: "60000"
depends_on:
cloud:
condition: service_healthy
daemon-simulator-1:
condition: service_started
daemon-simulator-2:
condition: service_started
volumes:
- ./test:/app/test:ro
- ./src:/app/src:ro
- test_results:/app/test-results
profiles:
- test
# WebSocket test client
ws-test-client:
build:
context: .
dockerfile: test/cloud/Dockerfile.ws-client
environment:
CLOUD_WS_URL: ws://cloud:3000/ws
TEST_DURATION_SECONDS: "60"
depends_on:
cloud:
condition: service_healthy
profiles:
- ws-test
volumes:
postgres_test_data:
test_results:
networks:
default:
name: agent-relay-test