services:
  postgres-test:
    image: timescale/timescaledb:2.15.2-pg16
    container_name: fundamental-postgres-test
    command: -c shared_preload_libraries=timescaledb
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: postgres
      POSTGRES_DB: fundamental_test
    ports:
      - "5433:5432"
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres -d fundamental_test"]
      interval: 5s
      timeout: 5s
      retries: 10
    networks:
      - test-network

  nats-test:
    image: nats:2.9
    container_name: fundamental-nats-test
    ports:
      - "4223:4222"
    networks:
      - test-network

  data-persistence-test:
    build:
      context: .
      dockerfile: services/data-persistence-service/Dockerfile
    container_name: data-persistence-service-test
    environment:
      HOST: 0.0.0.0
      PORT: 3000
      # Connect to postgres-test using internal docker network alias
      DATABASE_URL: postgresql://postgres:postgres@postgres-test:5432/fundamental_test
      RUST_LOG: info
      RUST_BACKTRACE: "1"
    ports:
      - "3001:3000"
    depends_on:
      postgres-test:
        condition: service_healthy
    networks:
      - test-network

networks:
  test-network:


