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
# Docker Compose for integration tests
#
# Authentication (choose one):
# Option 1: Set ANTHROPIC_API_KEY in environment or .env file
# Option 2: Set CLAUDE_CODE_OAUTH_TOKEN in environment or .env file
# (Generate with: claude setup-token)
#
# Usage:
# # Create .env file with your credentials (see .env.example)
# cp .env.example .env
# # Edit .env with your API key or OAuth token
#
# # Run all integration tests
# docker-compose -f docker-compose.integration-tests.yml up --build
#
# # Run with specific test filter
# TEST_FILTER=test_oneshot docker-compose -f docker-compose.integration-tests.yml up --build
#
# # Run interactively
# docker-compose -f docker-compose.integration-tests.yml run --rm tests bash
#
# Environment variables:
# ANTHROPIC_API_KEY - Anthropic API key (starts with sk-ant-)
# CLAUDE_CODE_OAUTH_TOKEN - Claude Code OAuth token (for Pro/Max users)
# TEST_FILTER - Filter tests by name pattern (optional)
# TEST_THREADS - Number of test threads (default: 1)
version: '3.8'
services:
tests:
build:
context: .
dockerfile: Dockerfile.integration-tests
env_file:
- path: .env
required: false
environment:
# Pass through auth - at least one must be set
- ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY:-}
- CLAUDE_CODE_OAUTH_TOKEN=${CLAUDE_CODE_OAUTH_TOKEN:-}
- RUST_BACKTRACE=1
- RUST_LOG=debug
command: >
sh -c "
# Validate authentication
if [ -z \"$ANTHROPIC_API_KEY\" ] && [ -z \"$CLAUDE_CODE_OAUTH_TOKEN\" ]; then
echo 'Error: Either ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN must be set'
echo ''
echo 'Options:'
echo ' 1. Set ANTHROPIC_API_KEY in .env or environment'
echo ' 2. Run \"claude setup-token\" locally, then set CLAUDE_CODE_OAUTH_TOKEN'
exit 1
fi
if [ -n \"${TEST_FILTER:-}\" ]; then
cargo test --features integration-tests -- ${TEST_FILTER} --test-threads=${TEST_THREADS:-1} --nocapture
else
cargo test --features integration-tests -- --test-threads=${TEST_THREADS:-1}
fi
"
# Limit resources to prevent runaway tests
deploy:
resources:
limits:
cpus: '2'
memory: 4G
# Allow tests to run for up to 30 minutes
stop_grace_period: 30m