#!/bin/bash
# Set up test environment: start infra, run migrations, load seeds
set -e

echo "Starting infrastructure..."
docker compose up -d postgres redis kafka minio

echo "Waiting for PostgreSQL..."
until docker compose exec -T postgres pg_isready -U genex; do sleep 1; done

echo "Running migrations..."
./scripts/migrate.sh --seed

echo "Starting all services..."
docker compose up -d

echo "Waiting for services to be ready..."
sleep 10

echo "Running E2E tests..."
./scripts/run-e2e.sh

echo "Done!"
