mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
Hermetic E2E harness targeting pricing integrity and backoffice config: - e2e/ docker Postgres (5544) + prepare.sh/run.sh one-command runner + HTML report - 6 suites / 23 tests reproducing pricing, FX, wallet, refund, config and auth defects (see docs/ISSUES.md); docs/e2e-test-matrix.md documents the matrix - two-tier harness (slim module boot + direct service instantiation) to work around the IAM/RabbitMQ/file-type boot wall - .env.test.example tracked; loader falls back to it for fresh checkouts Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Bring up the hermetic test DB and apply all migrations. Idempotent — safe to re-run.
|
|
# Usage: bash e2e/prepare.sh (from repo root or anywhere)
|
|
set -euo pipefail
|
|
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
API="$HERE/../apps/edr-passenger-api"
|
|
|
|
export DATABASE_URL="postgresql://edr:edr_secret@localhost:5544/edr_database?schema=passenger"
|
|
export DATABASE_HOST=localhost DATABASE_PORT=5544 DATABASE_NAME=edr_database
|
|
export DATABASE_USER=edr DATABASE_PASSWORD=edr_secret DATABASE_SCHEMA=iam
|
|
|
|
echo "==> Starting test Postgres (port 5544)"
|
|
docker compose -f "$HERE/docker-compose.yml" up -d
|
|
|
|
echo "==> Waiting for healthy"
|
|
for i in $(seq 1 30); do
|
|
status="$(docker inspect --format '{{.State.Health.Status}}' edr-passenger-e2e-db 2>/dev/null || echo none)"
|
|
[ "$status" = "healthy" ] && break
|
|
sleep 2
|
|
done
|
|
[ "${status:-}" = "healthy" ] || { echo "DB did not become healthy"; exit 1; }
|
|
|
|
echo "==> Prisma migrate deploy (passenger schema)"
|
|
( cd "$API" && npx prisma migrate deploy )
|
|
|
|
echo "==> IAM TypeORM migrations (iam schema)"
|
|
( cd "$API" && node scripts/run-iam-migrations.cjs )
|
|
|
|
echo "==> Prisma client generate"
|
|
( cd "$API" && npx prisma generate >/dev/null )
|
|
|
|
echo "==> Ready. Run: pnpm --filter @edr/passenger-api test:e2e"
|