-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
84 lines (77 loc) · 2.04 KB
/
docker-compose.test.yml
File metadata and controls
84 lines (77 loc) · 2.04 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
services:
test-postgres:
container_name: test-postgres
image: postgres:latest
ports:
- "15432:5432" # Different port to avoid conflicts
environment:
POSTGRES_USER: ${POSTGRES_USERNAME}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
tmpfs:
- /var/lib/postgresql/data # Use tmpfs for faster tests
healthcheck:
test: pg_isready -U postgres
interval: 2s
timeout: 3s
retries: 40
networks:
- test_purch
test-redis:
container_name: test-redis
image: redis:alpine
ports:
- "16379:6379" # Different port to avoid conflicts
tmpfs:
- /data # Use tmpfs for faster tests
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 2s
timeout: 1s
retries: 3
start_period: 5s
networks:
- test_purch
test-purch:
&test-purch
build:
context: .
dockerfile: docker/dockerfile.test
command: pytest --cov=purch -v # --cov-report=html:/app/coverage/html --cov-report=xml:/app/coverage/coverage.xml --cov-report=term-missing --junit-xml=/app/test-results/junit.xml
volumes:
- test_coverage:/app/coverage # Persist coverage reports
depends_on:
test-postgres:
condition: service_healthy
test-redis:
condition: service_healthy
env_file:
- ./.env
environment:
- POSTGRES_HOST=test-postgres
- REDIS_HOST=test-redis
networks:
- test_purch
test-taskiq-worker:
<<: *test-purch
ports: []
command: taskiq worker purch.infrastructure.taskiq:broker --fs-discover
restart: unless-stopped
environment:
- POSTGRES_HOST=test-postgres
- REDIS_HOST=test-redis
networks:
- test_purch
test-taskiq-scheduler:
<<: *test-purch
ports: []
command: taskiq scheduler purch.infrastructure.taskiq:scheduler --fs-discover
restart: unless-stopped
environment:
- POSTGRES_HOST=test-postgres
- REDIS_HOST=test-redis
networks:
- test_purch
networks:
test_purch:
volumes:
test_coverage: