version: '3.8'

services:
  postgres-test:
    image: postgres:15-alpine
    container_name: veza-postgres-test
    environment:
      POSTGRES_DB: veza_test
      POSTGRES_USER: veza_test
      POSTGRES_PASSWORD: veza_test
      POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C"
    ports:
      - "5434:5432"
    # Use tmpfs for faster tests and automatic cleanup
    tmpfs:
      - /var/lib/postgresql/data
    networks:
      - veza-test-network
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U veza_test"]
      interval: 5s
      timeout: 3s
      retries: 5
      start_period: 10s

  redis-test:
    image: redis:7-alpine
    container_name: veza-redis-test
    ports:
      - "6380:6379"
    # Use tmpfs for faster tests and automatic cleanup
    tmpfs:
      - /data
    networks:
      - veza-test-network
    healthcheck:
      test: ["CMD", "redis-cli", "ping"]
      interval: 5s
      timeout: 3s
      retries: 5
      start_period: 5s

networks:
  veza-test-network:
    driver: bridge
    name: veza-test-network

