forked from Kegbot/kegbot-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
56 lines (53 loc) · 1.65 KB
/
Copy pathdocker-compose.test.yml
File metadata and controls
56 lines (53 loc) · 1.65 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
# Self-contained test stack: MariaDB (with tz tables) + Redis + the app's test
# image. Run the full suite with:
#
# docker compose -f docker-compose.test.yml up --build --abort-on-container-exit
#
# Or a single file/test:
#
# docker compose -f docker-compose.test.yml run --rm --build test pytest pykeg/core/models_test.py
#
# Tear down (volumes included) when done:
#
# docker compose -f docker-compose.test.yml down -v
services:
db:
build: ./testing/db
environment:
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: "yes"
MARIADB_DATABASE: kegbot_test
tmpfs:
# Keep the test DB on a RAM disk — faster and disposable.
- /var/lib/mysql
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 3s
timeout: 5s
retries: 20
redis:
image: redis:7.2
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 3s
timeout: 5s
retries: 20
test:
build:
context: .
target: test
environment:
DATABASE_URL: mysql://root@db/kegbot_test
REDIS_URL: redis://redis:6379/0
KEGBOT_ENV: test
KEGBOT_SECRET_KEY: test-secret-key
# Tests assert absolute media URLs under the host that KEGBOT_BASE_URL
# defaults to under pytest (test.example.com). Without an absolute
# KEGBOT_MEDIA_URL, MEDIA_URL stays "/media/" and api_test.test_pictures
# fails. Mirrors the production guidance to set KEGBOT_MEDIA_URL behind a
# proxy (see CLAUDE.md).
KEGBOT_MEDIA_URL: http://test.example.com/media/
depends_on:
db:
condition: service_healthy
redis:
condition: service_healthy