28 lines
866 B
Bash
Executable File
28 lines
866 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
PG_BIN="${PG_BIN:-/opt/homebrew/opt/postgresql@17/bin}"
|
|
TEST_DB="queue_schema_test_$$"
|
|
|
|
cleanup() {
|
|
"$PG_BIN/dropdb" --if-exists --force "$TEST_DB" >/dev/null 2>&1 || true
|
|
}
|
|
trap cleanup EXIT INT TERM
|
|
|
|
"$PG_BIN/createdb" -O queue "$TEST_DB"
|
|
(
|
|
export TEST_DATABASE_URL="postgres://queue:queue@localhost:5432/$TEST_DB?sslmode=disable"
|
|
cd "$ROOT_DIR/server"
|
|
go test ./internal/database -run TestPostgresMigrationAndMaintenanceIntegration -count=1
|
|
)
|
|
|
|
set -a
|
|
source "$ROOT_DIR/server/.env"
|
|
set +a
|
|
export APP_ENV=development
|
|
export DATABASE_URL="postgres://queue:queue@localhost:5432/$TEST_DB?sslmode=disable"
|
|
export MIGRATE_ON_START=false
|
|
export SUPER_ADMIN_PASSWORD='IntegrationOnlyPassword123!'
|
|
(cd "$ROOT_DIR/server" && go run ./cmd/bootstrap-admin >/dev/null)
|