All 5 suggestions from the latest review pass.
## tests/e2e/_extract_token.py (new)
Extracted the 14-line python-in-bash heredoc from _lib.sh into a real
Python file. Easier to edit, fewer escaping traps, same behavior.
Shell helper now just shells out to it.
## tests/e2e/_lib.sh
- Replaced inline python with: python3 "$(dirname "${BASH_SOURCE[0]}")/_extract_token.py"
- Removed redundant sys.exit(0) as part of the extraction
## Shellcheck-clean scripts (new CI job enforces)
- Removed dead captures: BEFORE_COUNT (test_activity_e2e.sh), ORIG_SKILLS,
REIMPORT_SKILLS (test_api.sh), QA_TOKEN (test_comprehensive_e2e.sh)
- Renamed unused loop vars `i`, `j` -> `_` in 4 sites
- Added `# shellcheck disable=SC2046` on the two intentional word-splits
in test_claude_code_e2e.sh (docker stop/rm of multiple container IDs)
- Removed a useless re-register of QA mid-script (was done in Section 2)
## CI (.github/workflows/ci.yml)
- Replaced `sudo apt-get install postgresql-client` + psql with a direct
`docker exec` into the existing postgres:16 service container. Saves
~10-20s per CI run.
- Added new `shellcheck` job that lints tests/e2e/*.sh on every PR.
Local: shellcheck --severity=warning returns 0 across all 5 scripts.
## Verification
- go test -race ./internal/handlers/... : pass
- mcp-server: 96/96 jest
- canvas: 357/357 vitest + clean build
- tests/e2e/test_api.sh: 62/62
- tests/e2e/test_comprehensive_e2e.sh: 67/67
- shellcheck tests/e2e/*.sh : clean
- CI YAML: valid
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
1004 B
Bash
Executable File
31 lines
1004 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Common E2E helpers. Source this from every tests/e2e/*.sh.
|
|
#
|
|
# Usage:
|
|
# source "$(dirname "$0")/_lib.sh"
|
|
# e2e_cleanup_all_workspaces # call at top of script
|
|
# TOKEN=$(echo "$register_response" | e2e_extract_token)
|
|
#
|
|
# BASE defaults to http://localhost:8080. Set it before sourcing to override.
|
|
|
|
: "${BASE:=http://localhost:8080}"
|
|
export BASE
|
|
|
|
# Emit the auth_token from a /registry/register response on stdout.
|
|
# See _extract_token.py for the exact semantics.
|
|
e2e_extract_token() {
|
|
python3 "$(dirname "${BASH_SOURCE[0]}")/_extract_token.py"
|
|
}
|
|
|
|
# Delete every workspace currently on the platform. Use at the top of a
|
|
# script so count-based assertions are reproducible across runs.
|
|
e2e_cleanup_all_workspaces() {
|
|
for _wid in $(curl -s "$BASE/workspaces" | python3 -c "import json,sys
|
|
try:
|
|
[print(w['id']) for w in json.load(sys.stdin)]
|
|
except Exception:
|
|
pass" 2>/dev/null); do
|
|
curl -s -X DELETE "$BASE/workspaces/$_wid?confirm=true" > /dev/null || true
|
|
done
|
|
}
|