Repository navigation
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
94 lines (90 loc) · 3.81 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
94 lines (90 loc) · 3.81 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
# Used by CI's combined system-test job (.github/workflows/ci.yml) and by anyone
# running the full stack locally for backend/frontend system tests.
# See docs/design/12-testing-strategy.md.
services:
postgres:
image: postgres:16-alpine
environment:
POSTGRES_USER: logand_test
POSTGRES_PASSWORD: test
POSTGRES_DB: logand_test
ports:
- "5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U logand_test"]
interval: 5s
timeout: 5s
retries: 10
redis:
image: redis:7-alpine
ports:
- "6380:6379"
# A local HTTP double for the slice of Stripe's real API this backend
# calls (see testing/fake_stripe.py's own doc comment) -- lets the full
# stack's invoice-payment system tests exercise a REAL HTTP round trip
# through the real stripe-python SDK without a real Stripe test-mode
# account/API key. Not used by backend/tests/system's own pytest suite
# (those tests spin up their own copy in-process, see
# test_stripe_fake_server.py), only by anything driving this compose
# stack directly (frontend Playwright system tests, local manual runs).
fake-stripe:
build:
context: ./backend
command: ["python", "-m", "logand_backend.testing.fake_stripe"]
ports:
- "12111:12111"
# A real SMTP sink for the stack's own mail, same spirit as fake-stripe
# above: registration now mints an email-verification token and mails a
# link, and the only honest way to system-test "register -> verify ->
# log in" is to actually receive that mail. mailpit accepts SMTP on 1025
# and exposes the captured messages over an HTTP API on 8025, which
# customer-journey.spec.ts reads to pull the verification link back out.
# Without this the backend has no mail transport, notify_* silently
# no-ops (see domain/notifications/mailer.py::is_configured), and no
# token ever reaches the test.
mailpit:
image: axllent/mailpit:latest
ports:
- "1025:1025"
- "8025:8025"
backend:
build:
context: ./backend
environment:
DATABASE_URL: postgresql+asyncpg://logand_test:test@postgres:5432/logand_test
REDIS_URL: redis://redis:6379/0
SESSION_SECRET: test-secret-not-for-production
PAYMENT_PROCESSOR_SECRET: sk_test_fake
STRIPE_WEBHOOK_SECRET: whsec_fake
STRIPE_API_BASE: http://fake-stripe:12111
# Not a real key (payment-methods just echoes it) -- makes the pay
# page SHOW the card button so customer-journey.spec.ts can walk
# the real intent-minting round trip; the Payment Element iframe
# itself talks to Stripe's real servers and can't work against
# fake-stripe, which is exactly where that spec stops asserting.
STRIPE_PUBLISHABLE_KEY: pk_test_fake
# Guarantees a known admin account exists before any system test
# runs, without a separate seeding step in CI that could be
# forgotten -- see app/app.py's _seed_admin_if_configured. Frontend
# Playwright system tests (customer-journey.spec.ts) read these same
# two values back out of the environment to log in as this account.
SEED_ADMIN_EMAIL: admin-fixture@example.com
SEED_ADMIN_PASSWORD: admin-fixture-password-not-for-production
# Points every emailed link (verify-email, claim, password reset) at
# the Playwright dev server rather than the real site, so a link the
# test clicks stays inside the test stack.
PUBLIC_BASE_URL: http://localhost:5173
SMTP_HOST: mailpit
SMTP_PORT: 1025
# mailpit speaks plaintext SMTP; STARTTLS would fail the handshake.
SMTP_USE_TLS: "false"
SMTP_FROM_ADDRESS: noreply@logand.test
ports:
- "8000:8000"
depends_on:
postgres:
condition: service_healthy
fake-stripe:
condition: service_started
mailpit:
condition: service_started