Skip to content

Commit cea7e2a

Browse files
committed
test(e2e): ephemeral main sandbox name, fail fast on forward start
Make SANDBOX an ephemeral per-run name (NEMOCLAW_E2E_SANDBOX_NAME override, defaulting to `test-dash-$$`) so cleanup can never destroy a user's unrelated `test-dash` sandbox on local runs — same class of fix already applied to the install sandbox. Harden the defensive forward re-establishment: stop any existing forward first, then hard-fail if `openshell forward start` fails. Previously we swallowed the non-zero exit with `|| log ...`, which meant TC-DASH-0{1,2,3} could pass spuriously against a stale listener from another process. Signed-off-by: Evan Takahashi <evan10takahashi@gmail.com>
1 parent 2ff54ce commit cea7e2a

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

test/e2e/test-dashboard-reachability.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if [ -z "${NEMOCLAW_E2E_NO_TIMEOUT:-}" ]; then
2626
fi
2727

2828
# ── Config ───────────────────────────────────────────────────────────────────
29-
SANDBOX="test-dash"
29+
SANDBOX="${NEMOCLAW_E2E_SANDBOX_NAME:-test-dash-$$}"
3030
DASHBOARD_PORT="${NEMOCLAW_DASHBOARD_PORT:-18789}"
3131
DASHBOARD_URL="http://127.0.0.1:${DASHBOARD_PORT}/"
3232
POLL_ATTEMPTS=30
@@ -201,10 +201,17 @@ setup_sandbox() {
201201

202202
# Defensively re-establish the port-forward. nemoclaw onboard already
203203
# starts it, but an earlier crashed run can leave a stale entry and the
204-
# dashboard test is meaningless without a live forward.
204+
# dashboard test is meaningless without a live forward. Stop any existing
205+
# forward first so `forward start` is never a no-op against a stale
206+
# listener — if the fresh start fails we must fail the suite, since
207+
# TC-DASH-0{1,2,3} against a lingering listener would pass spuriously.
205208
log "Ensuring port-forward on $DASHBOARD_PORT..."
206-
openshell forward start --background "$DASHBOARD_PORT" "$SANDBOX" \
207-
>>"$LOG_FILE" 2>&1 || log " forward start returned non-zero (may already be running)"
209+
openshell forward stop "$DASHBOARD_PORT" >/dev/null 2>&1 || true
210+
if ! openshell forward start --background "$DASHBOARD_PORT" "$SANDBOX" \
211+
>>"$LOG_FILE" 2>&1; then
212+
echo -e "${RED}FATAL: failed to establish dashboard forward on $DASHBOARD_PORT${NC}"
213+
exit 1
214+
fi
208215

209216
log "Sandbox '$SANDBOX' onboarded successfully"
210217
echo ""

0 commit comments

Comments
 (0)