Files
ez-api/docker-compose.integration.yml
zenfun d147f3ab04 test(integration): reorganize test structure and add runner script
- Move integration tests and mock upstream resources from `integration/` to `test/` directory.
- Add `test/integration.sh` script to orchestrate environment setup and test execution.
- Update build context in `docker-compose.integration.yml` to match new structure.
- Add documentation for local development and integration testing workflows in README.
2025-12-02 15:56:17 +08:00

81 lines
1.7 KiB
YAML

version: '3.8'
services:
postgres:
image: postgres:15-alpine
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ezapi
ports:
- "5434:5432"
volumes:
- pgdata-int:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
ports:
- "6380:6379"
volumes:
- redisdata-int:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
mock-upstream:
build:
context: ./test/mock-upstream
dockerfile: Dockerfile
ports:
- "8082:8082"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:8082/health"]
interval: 5s
timeout: 5s
retries: 5
ez-api:
build:
context: .
dockerfile: Dockerfile
environment:
EZ_API_PORT: 8080
EZ_PG_DSN: host=postgres user=postgres password=postgres dbname=ezapi port=5432 sslmode=disable
EZ_REDIS_ADDR: redis:6379
ports:
- "8080:8080"
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
balancer:
build:
context: ../balancer
dockerfile: Dockerfile
environment:
EZ_BALANCER_PORT: 8081
EZ_REDIS_ADDR: redis:6379
EZ_BALANCER_REFRESH_SECONDS: 2
ports:
- "8081:8081"
depends_on:
redis:
condition: service_healthy
ez-api:
condition: service_started
mock-upstream:
condition: service_healthy
volumes:
pgdata-int:
redisdata-int: