forked from kellymusk/Aframp-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
131 lines (118 loc) · 4.72 KB
/
docker-compose.test.yml
File metadata and controls
131 lines (118 loc) · 4.72 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
version: "3.9"
# =============================================================================
# Integration test override — ephemeral services, no persistent volumes.
# Usage: docker compose -f docker-compose.yml -f docker-compose.test.yml up --abort-on-container-exit
# =============================================================================
services:
app:
environment:
APP_ENV: development
DATABASE_URL: "postgres://aframp:aframp_test@postgres:5432/aframp_test?sslmode=disable"
REDIS_URL: "redis://redis:6379"
LOG_LEVEL: "ERROR"
# No env_file — all config explicit for reproducibility
postgres:
environment:
POSTGRES_USER: aframp
POSTGRES_PASSWORD: aframp_test
POSTGRES_DB: aframp_test
volumes: [] # no persistent storage
tmpfs:
- /var/lib/postgresql/data
redis:
volumes: [] # no persistent storage
tmpfs:
- /data
command: redis-server --appendonly no
# Aframp Backend — integration test override
#
# Extends docker-compose.yml with ephemeral (no persistent volumes) services
# and test-specific environment variables. All data is discarded on teardown.
#
# Usage:
# docker compose -f docker-compose.yml -f docker-compose.test.yml up --build --abort-on-container-exit
# docker compose -f docker-compose.yml -f docker-compose.test.yml down -v
#
# The --abort-on-container-exit flag causes the stack to stop as soon as the
# test runner exits, and the exit code of the test runner is propagated.
# =============================================================================
services:
# ---------------------------------------------------------------------------
# Ephemeral PostgreSQL — no volume mount, data lives only for the test run
# ---------------------------------------------------------------------------
postgres:
environment:
POSTGRES_DB: aframp_test
POSTGRES_USER: aframp_test
POSTGRES_PASSWORD: test_password_not_for_production
# Override the volume with a tmpfs so nothing persists
volumes: []
tmpfs:
- /var/lib/postgresql/data
ports:
- "5433:5432"
# ---------------------------------------------------------------------------
# Ephemeral Redis — no volume mount
# ---------------------------------------------------------------------------
redis:
command: >
redis-server
--requirepass test_redis_password_not_for_production
--maxmemory 64mb
--maxmemory-policy allkeys-lru
--save ""
--appendonly no
volumes: []
ports:
- "6380:6379"
# ---------------------------------------------------------------------------
# Application — test configuration
# ---------------------------------------------------------------------------
app:
environment:
APP_ENV: test
DATABASE_URL: "postgres://aframp_test:test_password_not_for_production@postgres:5432/aframp_test"
REDIS_URL: "redis://:test_redis_password_not_for_production@redis:6379"
JWT_SECRET: "test-jwt-secret-not-for-production-use-only"
POSTGRES_PASSWORD: "test_password_not_for_production"
REDIS_PASSWORD: "test_redis_password_not_for_production"
LOG_LEVEL: "DEBUG"
# Disable external integrations so tests run without real credentials
SKIP_EXTERNALS: "false"
STELLAR_NETWORK: "testnet"
# Disable background workers during integration tests to reduce noise
TX_MONITOR_ENABLED: "false"
OFFRAMP_PROCESSOR_ENABLED: "false"
ONRAMP_PROCESSOR_ENABLED: "false"
BILL_PROCESSOR_ENABLED: "false"
PAYMENT_POLLER_ENABLED: "false"
WEBHOOK_RETRY_ENABLED: "false"
OTEL_SAMPLING_RATE: "0.0"
# ---------------------------------------------------------------------------
# Test runner — executes the integration test suite against the live stack
# ---------------------------------------------------------------------------
test-runner:
build:
context: .
dockerfile: Dockerfile
target: builder
depends_on:
app:
condition: service_healthy
environment:
DATABASE_URL: "postgres://aframp_test:test_password_not_for_production@postgres:5432/aframp_test"
REDIS_URL: "redis://:test_redis_password_not_for_production@redis:6379"
APP_BASE_URL: "http://app:8000"
APP_ENV: test
JWT_SECRET: "test-jwt-secret-not-for-production-use-only"
RUST_LOG: "debug"
command: >
cargo test --features database,cache,integration
-- --test-threads=1 --nocapture
# Propagate the test exit code so CI fails on test failure
restart: "no"
volumes:
# Override parent volumes with empty declarations so they are created as
# anonymous volumes and removed automatically with `docker compose down -v`
postgres_data:
redis_data: