-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdocker-compose.testing.yml
More file actions
371 lines (357 loc) · 10.4 KB
/
docker-compose.testing.yml
File metadata and controls
371 lines (357 loc) · 10.4 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
version: '3.8'
services:
# Main ContextLite Server (Testing)
contextlite:
build:
context: .
dockerfile: docker/Dockerfile
target: testing
image: contextlite/contextlite:test
container_name: contextlite-test
ports:
- "8083:8083"
volumes:
- test_data:/app/data
- test_logs:/app/logs
- .:/app/src:ro
- test_reports:/app/reports
environment:
- CONTEXTLITE_ENV=testing
- CONTEXTLITE_LOG_LEVEL=debug
- CONTEXTLITE_HOST=0.0.0.0
- CONTEXTLITE_PORT=8083
- CONTEXTLITE_DATABASE=/app/data/contextlite_test.db
- CONTEXTLITE_CONFIG_PATH=/app/configs/testing.yaml
- CONTEXTLITE_AUTH_TOKEN=test-token-12345
- POSTGRES_URL=postgres://contextlite_test:test_pass_123@postgres-test:5432/contextlite_test
- REDIS_URL=redis://redis-test:6379/1
- CLICKHOUSE_URL=http://clickhouse-test:8123
- GO_ENV=testing
- CGO_ENABLED=1
- ENABLE_RACE_DETECTION=true
- TEST_TIMEOUT=30m
networks:
- contextlite-test
restart: "no"
depends_on:
postgres-test:
condition: service_healthy
redis-test:
condition: service_healthy
clickhouse-test:
condition: service_healthy
healthcheck:
test: ["CMD", "/app/contextlite", "--health-check"]
interval: 5s
timeout: 3s
retries: 5
start_period: 15s
command: ["/app/contextlite", "--port", "8083", "--host", "0.0.0.0"]
# Test PostgreSQL Database
postgres-test:
image: postgres:16-alpine
container_name: contextlite-postgres-test
ports:
- "5433:5432" # Different port to avoid conflicts
volumes:
- postgres_test_data:/var/lib/postgresql/data
- ./pkg/adapters/postgresql/schemas:/docker-entrypoint-initdb.d
- ./test/sql:/test/sql:ro
environment:
- POSTGRES_DB=contextlite_test
- POSTGRES_USER=contextlite_test
- POSTGRES_PASSWORD=test_pass_123
- POSTGRES_INITDB_ARGS=--auth-host=md5
- POSTGRES_HOST_AUTH_METHOD=md5
networks:
- contextlite-test
healthcheck:
test: ["CMD-SHELL", "pg_isready -U contextlite_test -d contextlite_test"]
interval: 5s
timeout: 3s
retries: 10
restart: "no"
tmpfs:
- /var/lib/postgresql/data:noexec,nosuid,size=512m
# Test Redis Cache
redis-test:
image: redis:7-alpine
container_name: contextlite-redis-test
ports:
- "6380:6379" # Different port to avoid conflicts
volumes:
- redis_test_data:/data
command: ["redis-server", "--save", "", "--appendonly", "no", "--databases", "16"]
networks:
- contextlite-test
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
restart: "no"
# Test ClickHouse Analytics
clickhouse-test:
image: clickhouse/clickhouse-server:24.1-alpine
container_name: contextlite-clickhouse-test
ports:
- "8124:8123" # Different port to avoid conflicts
- "9001:9000" # Native interface
volumes:
- clickhouse_test_data:/var/lib/clickhouse
- ./configs/clickhouse/config.test.xml:/etc/clickhouse-server/config.xml
- ./pkg/adapters/clickhouse/schemas:/docker-entrypoint-initdb.d
environment:
- CLICKHOUSE_DB=contextlite_test
- CLICKHOUSE_USER=contextlite_test
- CLICKHOUSE_PASSWORD=test_pass_123
- CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1
networks:
- contextlite-test
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:8123/ping"]
interval: 5s
timeout: 3s
retries: 10
restart: "no"
ulimits:
nofile:
soft: 65536
hard: 65536
# Go Integration Tests
go-tests:
build:
context: .
dockerfile: docker/Dockerfile.test-runner
target: go-testing
image: contextlite/test-runner:go
container_name: contextlite-go-tests
volumes:
- .:/workspace:ro
- test_reports:/reports
- go_cache:/go/pkg/mod
- go_build_cache:/root/.cache/go-build
working_dir: /workspace
environment:
- CGO_ENABLED=1
- GO_ENV=testing
- CONTEXTLITE_TEST_DATABASE_URL=postgres://contextlite_test:test_pass_123@postgres-test:5432/contextlite_test
- CONTEXTLITE_TEST_REDIS_URL=redis://redis-test:6379/1
- CONTEXTLITE_TEST_CLICKHOUSE_URL=http://clickhouse-test:8123
- CONTEXTLITE_TEST_SERVER_URL=http://contextlite:8083
- GOCOVERDIR=/reports/coverage
- TEST_TIMEOUT=30m
networks:
- contextlite-test
depends_on:
contextlite:
condition: service_healthy
postgres-test:
condition: service_healthy
redis-test:
condition: service_healthy
clickhouse-test:
condition: service_healthy
command: ["./scripts/run-integration-tests.sh"]
restart: "no"
# Python Tests (LangChain/LlamaIndex adapters)
python-tests:
build:
context: .
dockerfile: docker/Dockerfile.test-runner
target: python-testing
image: contextlite/test-runner:python
container_name: contextlite-python-tests
volumes:
- .:/workspace:ro
- test_reports:/reports
- pip_cache:/root/.cache/pip
working_dir: /workspace
environment:
- PYTHONPATH=/workspace/adapters/python/contextlite_langchain:/workspace/adapters/python/contextlite_llamaindex
- CONTEXTLITE_SERVER_URL=http://contextlite:8083
- CONTEXTLITE_AUTH_TOKEN=test-token-12345
- PYTEST_CURRENT_TEST=true
networks:
- contextlite-test
depends_on:
contextlite:
condition: service_healthy
command: ["python", "-m", "pytest", "/workspace/test/python", "-v", "--junitxml=/reports/pytest.xml", "--cov=/workspace/adapters/python", "--cov-report=xml:/reports/coverage-python.xml"]
restart: "no"
# Node.js Tests (MCP Server)
node-tests:
build:
context: .
dockerfile: docker/Dockerfile.test-runner
target: nodejs-testing
image: contextlite/test-runner:nodejs
container_name: contextlite-node-tests
volumes:
- .:/workspace:ro
- test_reports:/reports
- node_cache:/root/.npm
working_dir: /workspace/adapters/node/mcp-server
environment:
- NODE_ENV=test
- CONTEXTLITE_SERVER_URL=http://contextlite:8083
- CONTEXTLITE_AUTH_TOKEN=test-token-12345
networks:
- contextlite-test
depends_on:
contextlite:
condition: service_healthy
command: ["npm", "test", "--", "--reporter", "xunit", "--reporter-options", "output=/reports/mocha.xml"]
restart: "no"
# Rust Tests (Client Library)
rust-tests:
build:
context: .
dockerfile: docker/Dockerfile.test-runner
target: rust-testing
image: contextlite/test-runner:rust
container_name: contextlite-rust-tests
volumes:
- .:/workspace:ro
- test_reports:/reports
- cargo_cache:/usr/local/cargo/registry
- cargo_target_cache:/workspace/adapters/rust/contextlite-client/target
working_dir: /workspace/adapters/rust/contextlite-client
environment:
- CARGO_HOME=/usr/local/cargo
- CONTEXTLITE_SERVER_URL=http://contextlite:8083
- CONTEXTLITE_AUTH_TOKEN=test-token-12345
networks:
- contextlite-test
depends_on:
contextlite:
condition: service_healthy
command: ["cargo", "test", "--release", "--", "--test-threads=1", "--nocapture"]
restart: "no"
# Load Testing
load-tests:
image: loadimpact/k6:latest
container_name: contextlite-load-tests
volumes:
- ./test/load:/scripts:ro
- test_reports:/reports
environment:
- K6_OUT=json=/reports/load-test-results.json
- CONTEXTLITE_SERVER_URL=http://contextlite:8083
- CONTEXTLITE_AUTH_TOKEN=test-token-12345
networks:
- contextlite-test
depends_on:
contextlite:
condition: service_healthy
command: ["run", "/scripts/load-test.js"]
restart: "no"
profiles:
- load
# Security Testing
security-tests:
image: owasp/zap2docker-stable:latest
container_name: contextlite-security-tests
volumes:
- test_reports:/zap/wrk:rw
environment:
- ZAP_PROXY=contextlite:8083
networks:
- contextlite-test
depends_on:
contextlite:
condition: service_healthy
command: ["zap-baseline.py", "-t", "http://contextlite:8083", "-J", "/zap/wrk/security-report.json"]
restart: "no"
profiles:
- security
# Test Report Aggregator
test-reporter:
build:
context: .
dockerfile: docker/Dockerfile.test-reporter
image: contextlite/test-reporter:latest
container_name: contextlite-test-reporter
volumes:
- test_reports:/reports:ro
- test_output:/output
environment:
- REPORT_FORMAT=html,json,junit
- COVERAGE_THRESHOLD=80
- OUTPUT_DIR=/output
networks:
- contextlite-test
depends_on:
- go-tests
- python-tests
- node-tests
- rust-tests
command: ["./generate-reports.sh"]
restart: "no"
profiles:
- reporting
# Database Migration Tester
migration-tests:
build:
context: .
dockerfile: docker/Dockerfile.migration-tester
image: contextlite/migration-tester:latest
container_name: contextlite-migration-tests
volumes:
- ./pkg/adapters:/adapters:ro
- ./migrations:/migrations:ro
- test_reports:/reports
environment:
- POSTGRES_URL=postgres://contextlite_test:test_pass_123@postgres-test:5432/contextlite_test
- CLICKHOUSE_URL=http://clickhouse-test:8123
- SQLITE_PATH=/tmp/migration_test.db
networks:
- contextlite-test
depends_on:
postgres-test:
condition: service_healthy
clickhouse-test:
condition: service_healthy
command: ["./test-migrations.sh"]
restart: "no"
profiles:
- migration
volumes:
test_data:
driver: local
test_logs:
driver: local
test_reports:
driver: local
test_output:
driver: local
postgres_test_data:
driver: tmpfs
driver_opts:
tmpfs-size: 512m
redis_test_data:
driver: tmpfs
driver_opts:
tmpfs-size: 256m
clickhouse_test_data:
driver: tmpfs
driver_opts:
tmpfs-size: 1g
go_cache:
driver: local
go_build_cache:
driver: local
pip_cache:
driver: local
node_cache:
driver: local
cargo_cache:
driver: local
cargo_target_cache:
driver: local
networks:
contextlite-test:
driver: bridge
ipam:
config:
- subnet: 172.24.0.0/16