Repository navigation
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
130 lines (117 loc) · 3.71 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
130 lines (117 loc) · 3.71 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
# Docker Compose for Testing CUDly
# Use this for local E2E testing and integration tests
services:
# PostgreSQL Database
postgres:
# Digest-pinned for the same reason as the ci.yml service container and the
# linter images: a floating tag lets the database change under an unchanged
# repo. This file is what ci.yml's e2e-tests job runs, so leaving it float
# would have pinned the integration-tests path and left e2e open.
image: postgres:16-alpine@sha256:cf78e76683b9ca8c5733cbbdce6c9262b45b6767934dd0a95e671f9a0fc20685
container_name: cudly-test-postgres
environment:
POSTGRES_DB: cudly_test
POSTGRES_USER: cudly_test
POSTGRES_PASSWORD: test_password
ports:
- "5432:5432"
volumes:
- postgres_test_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cudly_test"]
interval: 5s
timeout: 3s
retries: 5
networks:
- cudly-test
# CUDly Application (HTTP mode)
cudly-app:
build:
context: .
dockerfile: Dockerfile
container_name: cudly-test-app
depends_on:
postgres:
condition: service_healthy
environment:
# Runtime configuration
RUNTIME_MODE: http
PORT: 8080
ENVIRONMENT: test
VERSION: test
# Database configuration
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: cudly_test
DB_USER: cudly_test
DB_PASSWORD: test_password
DB_SSL_MODE: disable
DB_AUTO_MIGRATE: "true"
DB_MIGRATIONS_PATH: /app/migrations
# Secret provider (use env for testing). With the env provider,
# *_SECRET variables name the environment variable holding the value.
SECRET_PROVIDER: env
ADMIN_EMAIL: admin@test.example
ADMIN_PASSWORD_SECRET: TEST_ADMIN_PASSWORD
TEST_ADMIN_PASSWORD: e2e-local-test-only-password
# Allow the all-zero dev encryption key; this stack never holds real
# cloud credentials.
CREDENTIAL_ENCRYPTION_ALLOW_DEV_KEY: "1"
# Scheduled-task auth: disabled for the local/CI compose stack (no
# cloud OIDC issuer or bearer secret available)
SCHEDULED_TASK_AUTH_MODE: disabled
# DynamoDB tables (for backward compatibility testing)
CONFIG_TABLE: test-config
PLANS_TABLE: test-plans
HISTORY_TABLE: test-history
USERS_TABLE: test-users
GROUPS_TABLE: test-groups
SESSIONS_TABLE: test-sessions
# Email configuration: disabled, the app falls back to a no-op sender
# (SECRET_PROVIDER=env is not a supported email backend)
EMAIL_ENABLED: "false"
EMAIL_ADDRESS: test@example.com
# Feature flags
ENABLE_DASHBOARD: "true"
# CORS
CORS_ALLOWED_ORIGIN: http://localhost:3000
ports:
- "8080:8080"
networks:
- cudly-test
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
interval: 10s
timeout: 3s
retries: 3
start_period: 10s
# Test runner: black-box E2E suite (tests/e2e) against cudly-app over HTTP.
test-runner:
build:
context: .
dockerfile: Dockerfile.test
container_name: cudly-test-runner
depends_on:
postgres:
condition: service_healthy
cudly-app:
condition: service_healthy
environment:
# Point to test services
API_URL: http://cudly-app:8080
DB_HOST: postgres
DB_PORT: 5432
DB_NAME: cudly_test
DB_USER: cudly_test
DB_PASSWORD: test_password
DB_SSL_MODE: disable
networks:
- cudly-test
command: ["go", "test", "-v", "-tags=e2e", "./..."]
profiles:
- test # Only start with: docker compose --profile test up
networks:
cudly-test:
driver: bridge
volumes:
postgres_test_data: