rwadurian/backend/services/reporting-service/docker-compose.test.yml

51 lines
1.2 KiB
YAML

version: '3.8'
services:
postgres-test:
image: postgres:15-alpine
container_name: reporting-postgres-test
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: rwadurian_reporting_test
ports:
- "5433:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 5s
timeout: 5s
retries: 5
tmpfs:
- /var/lib/postgresql/data
redis-test:
image: redis:7-alpine
container_name: reporting-redis-test
ports:
- "6380:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 5s
retries: 5
reporting-service-test:
build:
context: .
dockerfile: Dockerfile.test
container_name: reporting-service-test
depends_on:
postgres-test:
condition: service_healthy
redis-test:
condition: service_healthy
environment:
NODE_ENV: test
DATABASE_URL: postgresql://postgres:postgres@postgres-test:5432/rwadurian_reporting_test?schema=public
REDIS_HOST: redis-test
REDIS_PORT: 6379
JWT_SECRET: test-secret-key
volumes:
- ./coverage:/app/coverage
command: sh -c "npx prisma db push --skip-generate && npm run test:cov"