-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.test.yml
More file actions
89 lines (84 loc) · 2.47 KB
/
docker-compose.test.yml
File metadata and controls
89 lines (84 loc) · 2.47 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
# This compose is dedicated to API testing only
services:
# Test database - isolated from main app
test-db:
container_name: focuz-test-db
image: postgres:15-alpine
environment:
POSTGRES_DB: focuz_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
ports:
- "5433:5432" # Different port to avoid conflicts
volumes:
- test_db_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d focuz_test"]
interval: 2s
timeout: 5s
retries: 10
networks:
- focuz-test-network
# Test Minio - for file storage
test-minio:
container_name: focuz-test-minio
image: minio/minio:latest
command: server /data --console-address ":9001"
ports:
- "9002:9000" # Different port to avoid conflicts
- "9003:9001" # Different port to avoid conflicts
environment:
- MINIO_ROOT_USER=minioadmin
- MINIO_ROOT_PASSWORD=minioadmin
networks:
- focuz-test-network
# Test API - builds API image from focuz-api and runs against test services
test-api:
container_name: focuz-test-api
build:
context: ./focuz-api
dockerfile: Dockerfile
environment:
DATABASE_URL: postgres://postgres:password@test-db:5432/focuz_test?sslmode=disable
APP_ENV: test
MINIO_ENDPOINT: test-minio:9000
MINIO_EXTERNAL_ENDPOINT: localhost:9002
MINIO_ACCESS_KEY: minioadmin
MINIO_SECRET_KEY: minioadmin
MINIO_BUCKET: notes
MINIO_USE_SSL: false
JWT_SECRET: test-secret-change-me-please-0123456789abcdef
depends_on:
test-db:
condition: service_healthy
test-minio:
condition: service_started
ports:
- "8081:8080" # Different port to avoid conflicts
volumes:
- ./focuz-api/migrations:/root/migrations
command: ["./focuz-api"]
networks:
- focuz-test-network
# Test runner - executes Go tests inside API module
test-runner:
container_name: focuz-test-runner
image: golang:1.24-alpine
environment:
DATABASE_URL: postgres://postgres:password@test-db:5432/focuz_test?sslmode=disable
API_URL: http://test-api:8080
DOCKER: "1"
depends_on:
test-api:
condition: service_started
volumes:
- ./focuz-api:/app
working_dir: /app
command: ["go", "test", "-v", "-p=1", "./handlers"]
networks:
- focuz-test-network
networks:
focuz-test-network:
driver: bridge
volumes:
test_db_data: