Retry the e2e login while the server is coming up
Why: one isolated run reached a listening server and still failed the single login attempt, while the same data accepted the password a moment later. Evidence: replaying the login against that data directory returned HTTP 200. Impact: the seed retries login for a few seconds before it stops. The password and the set-password step are unchanged. Refs: scripts/e2e.sh Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+10
-3
@@ -124,9 +124,16 @@ stop_serve() {
|
||||
[ -n "${API_PID:-}" ] && { kill "$API_PID" 2>/dev/null || true; wait "$API_PID" 2>/dev/null || true; API_PID=""; }
|
||||
}
|
||||
login() {
|
||||
curl -sf -c "$JAR" -X POST "$API_BASE/api/auth/login" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"owner\":\"$OWNER\",\"password\":\"$PASSWORD\"}" >/dev/null || die "login failed"
|
||||
local i
|
||||
for i in $(seq 1 20); do
|
||||
if curl -sf -c "$JAR" -X POST "$API_BASE/api/auth/login" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"owner\":\"$OWNER\",\"password\":\"$PASSWORD\"}" >/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
sleep 0.25
|
||||
done
|
||||
die "login failed"
|
||||
}
|
||||
# CLI 建号留下 must_change_password。会话在改密前不能调用业务命令。
|
||||
# 强制设密会作废当前会话,所以设密后用新密码再登录。
|
||||
|
||||
Reference in New Issue
Block a user