Files
Clintchiz 2c960fc1dc
Quality / quality (ubuntu-latest) (push) Failing after 9m49s
Quality / quality (windows-latest) (push) Canceled after 0s
refactor: migrate legacy wire namespace to wrn
2026-08-12 18:51:15 +05:30

28 lines
957 B
Bash

#!/usr/bin/env bash
# Spin up Postgres + MySQL, run the live DB integration tests, tear down.
# Requires Docker. From the repo root: bun run test:db:live
set -euo pipefail
cd "$(dirname "$0")/.."
COMPOSE="docker compose -f docker-compose.yml"
cleanup() { $COMPOSE down -v >/dev/null 2>&1 || true; }
trap cleanup EXIT
echo "Starting Postgres + MySQL…"
$COMPOSE up -d
echo "Waiting for databases to become healthy…"
for _ in $(seq 1 60); do
pg=$(docker inspect --format '{{.State.Health.Status}}' "$($COMPOSE ps -q postgres)" 2>/dev/null || echo starting)
my=$(docker inspect --format '{{.State.Health.Status}}' "$($COMPOSE ps -q mysql)" 2>/dev/null || echo starting)
[ "$pg" = healthy ] && [ "$my" = healthy ] && break
sleep 2
done
export WRNEXUS_PG_URL="postgres://wrn:wrn@localhost:5433/wrn_test"
export WRNEXUS_MYSQL_URL="mysql://wrn:wrn@localhost:3307/wrn_test"
echo "Running live DB tests…"
bun test packages/db/test/live-db.test.ts