From 2475b571beeabea4a80f54a43e13d881c78cf689 Mon Sep 17 00:00:00 2001 From: ITBlacksheep Date: Mon, 12 Oct 2026 03:56:04 +0000 Subject: [PATCH] Fixing issue where if a e2e test fails late and restarts random test would fail --- .DS_Store | Bin 6148 -> 0 bytes .github/workflows/deploy.yml | 18 ++-------------- scripts/e2e-fresh-server.sh | 40 +++++++++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 16 deletions(-) delete mode 100644 .DS_Store create mode 100644 scripts/e2e-fresh-server.sh diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 1042fc9ad61507929be0d2241a700ea277ddd7f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHKJ8DBg43rWVh7fS+axah~H&~2wf?OcP9|!~taSSeBm2>52nUPe)yri=mGXiOL zwVHjrDW0Cp%om6CquI>Nrf{NtF^rAp^pV|E#({9$@nBnfv!i|5VO0Hhg4}!5Z)}hF zoBzSwcD-M{?so4ilSu(7AO)m=6p#XEP@tOX^zICI=?W_w=?$tC-^_}|0zj3DIf)|N&%lNpO*`~QuWr+%dyus_zRph-*6h%K|zRi k42*V+4cqZNin6Y8jq_eOBnBP%pab/dev/null || true - sleep 1 - ./corescope-server -port 13581 -db test-fixtures/e2e-fixture.db -public public-instrumented & - echo $! > .server.pid - for i in $(seq 1 30); do - if curl -sf http://localhost:13581/api/healthz > /dev/null 2>&1; then - echo "Server ready after ${i}s" - break - fi - if [ "$i" -eq 30 ]; then - echo "Server failed to start within 30s" - exit 1 - fi - sleep 1 - done + run: bash scripts/e2e-fresh-server.sh - name: Run Playwright E2E tests (fail-fast) run: | @@ -665,6 +650,7 @@ jobs: run_e2e_suite || { echo "::warning::E2E suite failed - flake-guard retry once (issue #61)" cp e2e-output.txt e2e-output.attempt1.txt 2>/dev/null || true + bash scripts/e2e-fresh-server.sh run_e2e_suite } diff --git a/scripts/e2e-fresh-server.sh b/scripts/e2e-fresh-server.sh new file mode 100644 index 00000000..982e1a2d --- /dev/null +++ b/scripts/e2e-fresh-server.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Restore the pristine E2E fixture, freshen its timestamps, and (re)start the +# server. The Packets page defaults to a 15-minute window, so fixture data goes +# stale ~15 min after freshen; every suite attempt needs its own fresh start. +# Run from the repo root. +set -euo pipefail + +PORT="${E2E_PORT:-13581}" +DB="${E2E_DB:-test-fixtures/e2e-fixture.db}" +PRISTINE="${E2E_PRISTINE:-/tmp/e2e-fixture.pristine.db}" +PUBLIC_DIR="${E2E_PUBLIC:-public-instrumented}" +LOG="${E2E_SERVER_LOG:-server.log}" + +# First call: snapshot the seeded fixture before the server ever opens it. +if [ ! -f "$PRISTINE" ]; then + sqlite3 "$DB" "PRAGMA wal_checkpoint(TRUNCATE);" >/dev/null 2>&1 || true + cp "$DB" "$PRISTINE" +fi + +if [ -f .server.pid ]; then kill "$(cat .server.pid)" 2>/dev/null || true; fi +fuser -k "$PORT"/tcp 2>/dev/null || true +sleep 1 + +rm -f "$DB-wal" "$DB-shm" +cp "$PRISTINE" "$DB" +bash tools/freshen-fixture.sh "$DB" + +./corescope-server -port "$PORT" -db "$DB" -public "$PUBLIC_DIR" >"$LOG" 2>&1 & +echo $! > .server.pid + +for i in $(seq 1 180); do + if curl -sf "http://localhost:$PORT/api/healthz" >/dev/null 2>&1; then + echo "Server ready after ${i}s" + exit 0 + fi + sleep 1 +done +echo "Server failed to start within 180s" >&2 +tail -n 50 "$LOG" >&2 || true +exit 1 \ No newline at end of file