-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathcompose.test.yml
More file actions
185 lines (177 loc) · 4.73 KB
/
compose.test.yml
File metadata and controls
185 lines (177 loc) · 4.73 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
# Production image testing with optional E2E mock services
#
# Profiles:
# - (default): app + mock-oauth2 only
# - test: includes playwright for running E2E tests
# - e2e: includes mock-prowlarr and mock-qbittorrent
#
# Usage:
# # Basic prod image testing with OIDC
# docker compose -f compose.test.yml up -d
#
# # Run playwright E2E tests
# docker compose -f compose.test.yml --profile test up -d
# docker compose -f compose.test.yml --profile test run playwright
#
# # Full E2E with mock services
# docker compose -f compose.test.yml --profile e2e --profile test up -d
# docker compose -f compose.test.yml --profile e2e --profile test run playwright
services:
app:
image: mydia:test
container_name: mydia_test
environment:
PHX_HOST: localhost
PORT: 4000
SECRET_KEY_BASE: "VlPUd2fbnWjh6Di+7SGc2SSXpNhI0hN766FFAlct65wU5ARyiGvK9r3TqSqKyu0K"
GUARDIAN_SECRET_KEY: "VlPUd2fbnWjh6Di+7SGc2SSXpNhI0hN766FFAlct65wU5ARyiGvK9r3TqSqKyu0K"
DATABASE_PATH: /config/mydia.db
MIX_ENV: prod
METADATA_RELAY_URL: ${METADATA_RELAY_URL:-https://relay.mydia.dev}
# OIDC configuration for testing
OIDC_ENABLED: "true"
OIDC_ISSUER: "http://mock-oauth2:8080/default"
OIDC_CLIENT_ID: "mydia"
OIDC_CLIENT_SECRET: "secret"
OIDC_SCOPES: "openid profile email"
# Mock service URLs for E2E testing (used with --profile e2e)
PROWLARR_URL: "http://mock-prowlarr:9696"
PROWLARR_API_KEY: "test-api-key"
QBITTORRENT_URL: "http://mock-qbittorrent:8080"
QBITTORRENT_USERNAME: "admin"
QBITTORRENT_PASSWORD: "adminpass"
ports:
- "4000:4000"
volumes:
- test_config:/config
- test_data:/data
- test_media:/media
restart: unless-stopped
depends_on:
mock-oauth2:
condition: service_started
mock-prowlarr:
condition: service_healthy
required: false
mock-qbittorrent:
condition: service_healthy
required: false
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4000/health"]
interval: 30s
timeout: 3s
start_period: 40s
retries: 3
mock-oauth2:
image: ghcr.io/navikt/mock-oauth2-server:2.1.10
container_name: mydia_test_oauth
ports:
- "8080:8080"
environment:
JSON_CONFIG: |
{
"interactiveLogin": true,
"httpServer": "NettyWrapper",
"tokenCallbacks": [
{
"issuerId": "default",
"tokenExpiry": 3600,
"requestMappings": [
{
"requestParam": "grant_type",
"match": "authorization_code",
"claims": {
"sub": "test-user",
"aud": ["mydia"],
"email": "test@example.com",
"name": "Test User"
}
}
]
}
]
}
# E2E profile: Mock external services
mock-prowlarr:
build:
context: ./test/mock_services/prowlarr
dockerfile: Dockerfile
container_name: mydia_mock_prowlarr
profiles:
- e2e
ports:
- "19696:9696"
environment:
PORT: 9696
API_KEY: "test-api-key"
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://127.0.0.1:9696/health",
]
interval: 10s
timeout: 3s
start_period: 10s
retries: 3
mock-qbittorrent:
build:
context: ./test/mock_services/qbittorrent
dockerfile: Dockerfile
container_name: mydia_mock_qbittorrent
profiles:
- e2e
ports:
- "8082:8080"
environment:
PORT: 8080
USERNAME: "admin"
PASSWORD: "adminpass"
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://127.0.0.1:8080/health",
]
interval: 10s
timeout: 3s
start_period: 10s
retries: 3
# Test profile: Playwright test runner
playwright:
image: mcr.microsoft.com/playwright:v1.56.1-noble
container_name: mydia_playwright
working_dir: /work
command: npm run test:e2e
environment:
E2E_BASE_URL: http://localhost:4000
CI: "true"
volumes:
- ./assets:/work
depends_on:
app:
condition: service_healthy
mock-prowlarr:
condition: service_healthy
required: false
mock-qbittorrent:
condition: service_healthy
required: false
network_mode: "service:app"
profiles:
- test
volumes:
test_config:
driver: local
test_data:
driver: local
test_media:
driver: local