test(e2e): add isolated browser journey and cleanup supervision
Add a fake-only end-to-end stack, Firefox journey, and bounded process cleanup for normal, failed, and interrupted runs. Refs #12 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
28
backend/scripts/test-e2e-worker.sh
Executable file
28
backend/scripts/test-e2e-worker.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
project_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
managed_tmp="${TMPDIR:-${IDEA_MANAGED_TMP:-/tmp}}"
|
||||
pg_home="$managed_tmp/tradarr-embedded-postgres"
|
||||
cli="$pg_home/bin/embedded-postgres"
|
||||
if [[ ! -x "$cli" ]] || [[ "$("$cli" version)" != *'"version":"v2.0.1"'* ]]; then
|
||||
echo 'E2E requires cached embedded-postgres v2.0.1; prepare with make test-postgres.' >&2
|
||||
exit 2
|
||||
fi
|
||||
psql_path="$(find "$pg_home/cache" -type f -path '*/postgresql-16.15.1-*/bin/psql' -print -quit)"
|
||||
if [[ -z "$psql_path" ]]; then
|
||||
echo 'E2E requires cached PostgreSQL 16.15.1; prepare with make test-postgres.' >&2
|
||||
exit 2
|
||||
fi
|
||||
# The independent supervisor owns this directory and every process below us.
|
||||
: "${TRADARR_E2E_RUN_DIR:?invoke make test-e2e through its supervisor}"
|
||||
run_dir="$TRADARR_E2E_RUN_DIR"
|
||||
export GOCACHE="${GOCACHE:-$managed_tmp/go-build}"
|
||||
export GOMODCACHE="${GOMODCACHE:-$managed_tmp/gomodcache}"
|
||||
# No dependency installation/network downloads during an E2E run.
|
||||
export GOPROXY=off GOSUMDB=off npm_config_update_notifier=false
|
||||
unset DATABASE_URL TEST_DATABASE_URL PGHOST PGPORT PGUSER PGPASSWORD PGDATABASE PGSSLMODE TRADARR_E2E_STACK_MANIFEST NO_COLOR FORCE_COLOR
|
||||
cd "$project_root/backend"
|
||||
go build -o "$run_dir/e2e-stack" ./cmd/e2e
|
||||
exec "$cli" exec --offline --postgres-version 16.15.1 --database tradarr_e2e \
|
||||
--cache-dir "$pg_home/cache" --work-dir "$run_dir/db" \
|
||||
-- "$run_dir/e2e-stack" -work "$run_dir" -psql "$psql_path"
|
||||
Reference in New Issue
Block a user