From e691065b0a23af073e68df619170349e2e173133 Mon Sep 17 00:00:00 2001 From: Hongming Wang Date: Thu, 16 Apr 2026 06:29:44 -0700 Subject: [PATCH] fix(e2e): fall back to test-token when register doesn't return a new token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On re-registration (workspace already has tokens), the register endpoint doesn't issue a new token — it returns the existing one in the response or omits it. The e2e_extract_token helper returns empty in that case. Fall back to the per-workspace token we already minted via test-token. --- tests/e2e/test_api.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/e2e/test_api.sh b/tests/e2e/test_api.sh index 0936e123..7b07c47b 100644 --- a/tests/e2e/test_api.sh +++ b/tests/e2e/test_api.sh @@ -94,7 +94,10 @@ R=$(curl -s -X POST "$BASE/registry/register" -H "Content-Type: application/json ${ECHO_WS_TOKEN:+-H "Authorization: Bearer $ECHO_WS_TOKEN"} \ -d "{\"id\":\"$ECHO_ID\",\"url\":\"http://localhost:8001\",\"agent_card\":{\"name\":\"Echo Agent\",\"skills\":[{\"id\":\"echo\",\"name\":\"Echo\"}]}}") check "POST /registry/register (echo)" '"status":"registered"' "$R" +# Extract token from register response; fall back to the test-token we +# already minted (register may not return a new token on re-registration). ECHO_TOKEN=$(echo "$R" | e2e_extract_token) +if [ -z "$ECHO_TOKEN" ]; then ECHO_TOKEN="$ECHO_WS_TOKEN"; fi # Test 8: Register summarizer — same pattern: workspace-specific token SUM_WS_TOKEN=$(curl -s "$BASE/admin/workspaces/$SUM_ID/test-token" | python3 -c "import sys,json; print(json.load(sys.stdin).get('auth_token',''))" 2>/dev/null || echo "") @@ -103,6 +106,7 @@ R=$(curl -s -X POST "$BASE/registry/register" -H "Content-Type: application/json -d "{\"id\":\"$SUM_ID\",\"url\":\"http://localhost:8002\",\"agent_card\":{\"name\":\"Summarizer\",\"skills\":[{\"id\":\"summarize\",\"name\":\"Summarize\"}]}}") check "POST /registry/register (summarizer)" '"status":"registered"' "$R" SUM_TOKEN=$(echo "$R" | e2e_extract_token) +if [ -z "$SUM_TOKEN" ]; then SUM_TOKEN="$SUM_WS_TOKEN"; fi # Test 9: Both online R=$(acurl "$BASE/workspaces/$ECHO_ID")