test(notify): pre-sweep prior workspaces so interrupted runs don't pile up
User flagged a leftover "Notify E2E" workspace on the canvas — caused by an earlier debug run getting SIGPIPE'd before the EXIT trap could fire. Add an idempotent pre-sweep at the top of the script so the next run cleans up any prior leftover with the same name. Belt-and-suspenders with the existing trap; both have to fail for a leak to persist. Verified: - Normal run: 14/14 pass, 0 leftovers - SIGTERM mid-setup: trap fires, 0 leftovers - Re-run after interruption: pre-sweep + new run both clean Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
f547c4e259
commit
49fb5fdaf6
@ -66,6 +66,23 @@ assert_contains() {
|
||||
}
|
||||
|
||||
echo "=== Setup ==="
|
||||
# Idempotent pre-sweep: a prior run that got SIGPIPE'd or kill -9'd before
|
||||
# the EXIT trap fired would leave a "Notify E2E" workspace sitting on the
|
||||
# canvas. Find and delete any with this exact name so the test is safe to
|
||||
# re-run from any state. Match by name (not tag) so this also catches
|
||||
# leftovers created by older script versions.
|
||||
PRIOR=$(curl -s "$BASE/workspaces" | python3 -c '
|
||||
import json, sys
|
||||
try:
|
||||
print(" ".join(w["id"] for w in json.load(sys.stdin) if w.get("name") == "Notify E2E"))
|
||||
except Exception:
|
||||
pass
|
||||
')
|
||||
for _wid in $PRIOR; do
|
||||
echo "Sweeping leftover Notify E2E workspace: $_wid"
|
||||
curl -s -X DELETE "$BASE/workspaces/$_wid?confirm=true" > /dev/null || true
|
||||
done
|
||||
|
||||
R=$(curl -s -X POST "$BASE/workspaces" -H "Content-Type: application/json" \
|
||||
-d '{"name":"Notify E2E","tier":1}')
|
||||
WSID=$(echo "$R" | python3 -c 'import json,sys;print(json.load(sys.stdin)["id"])' 2>/dev/null || true)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user