From fdeaab8b6d7713868b33834436227fe707901882 Mon Sep 17 00:00:00 2001 From: Hung Le Date: Sat, 13 Jun 2026 01:54:52 +0000 Subject: [PATCH] fix(e2e): add gateway connectivity retry before recovery approve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the legacy gateway-pinned approve deliberately fails in the issue-4462 characterization test, the gateway WebSocket can be transiently unreachable. The immediate recovery approve then fails with "gateway connect failed". Add a short polling loop (5 × 2 s) that waits for device_state_json to succeed before issuing the recovery approve, giving the gateway time to stabilise after the failed request. Signed-off-by: Hung Le --- .../test-issue-4462-scope-upgrade-approval.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/e2e/test-issue-4462-scope-upgrade-approval.sh b/test/e2e/test-issue-4462-scope-upgrade-approval.sh index 8933626a70..96c5faf143 100755 --- a/test/e2e/test-issue-4462-scope-upgrade-approval.sh +++ b/test/e2e/test-issue-4462-scope-upgrade-approval.sh @@ -602,6 +602,23 @@ exit 0 if [ -n "$pending_after" ]; then pass "legacy gateway-pinned approve leaves the CLI scope-upgrade request pending" recovery_request_id="$pending_after" + # Wait for the gateway WebSocket to stabilise after the legacy approve + # failure — the failed request can leave the connection transiently + # unreachable, causing an immediate recovery approve to fail with + # "gateway connect failed". + local gw_ready=0 + for _gw_attempt in 1 2 3 4 5; do + if device_state_json >/dev/null 2>&1; then + gw_ready=1 + break + fi + info "gateway not yet reachable (attempt ${_gw_attempt}/5), waiting 2 s …" + sleep 2 + done + if [ "$gw_ready" -eq 0 ]; then + fail "gateway did not become reachable within 10 s after legacy approve failure" + return 1 + fi approve_request "$recovery_request_id" "recovery after legacy characterization" 1 || return 1 pass "fixed devices approve path recovers the pending legacy request" return 0