test(gate): fix bitcoin-knots getinfo-after-restart helper + IBD note

It called bats-assert's `fail` (not loaded in this file) → "fail:
command not found"/127, masking the real reason. Emit+return instead,
bump the cold-restart RPC window 60s→120s (block-index reload), and
note a node mid-IBD legitimately can't serve getinfo (environmental
precondition, not a product regression).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
archipelago 2026-06-23 06:28:20 -04:00
parent deff380191
commit ccb594fb85

View File

@ -137,15 +137,23 @@ ssh_podman_ps() {
@test "bitcoin.getinfo succeeds after restart" { @test "bitcoin.getinfo succeeds after restart" {
[[ "${ARCHY_ALLOW_DESTRUCTIVE:-0}" == "1" ]] || skip "ARCHY_ALLOW_DESTRUCTIVE not set" [[ "${ARCHY_ALLOW_DESTRUCTIVE:-0}" == "1" ]] || skip "ARCHY_ALLOW_DESTRUCTIVE not set"
# Give bitcoind up to 60s to accept RPC after cold restart # Give bitcoind up to 120s to accept RPC after a cold restart — reloading the
local deadline=$(( $(date +%s) + 60 )) # block index + chainstate can take a while even on a synced node.
local deadline=$(( $(date +%s) + 120 ))
while (( $(date +%s) < deadline )); do while (( $(date +%s) < deadline )); do
if rpc_call bitcoin.getinfo | jq -e '.error == null' >/dev/null 2>&1; then if rpc_call bitcoin.getinfo | jq -e '.error == null' >/dev/null 2>&1; then
return 0 return 0
fi fi
sleep 3 sleep 3
done done
fail "bitcoin.getinfo never recovered after restart" # NB: bats-assert's `fail` is not loaded in this file (only ../lib/rpc.bash),
# so emit + return non-zero directly rather than calling an undefined helper
# (which fails with "fail: command not found" / status 127 and hides the real
# reason). A node mid-IBD legitimately can't serve getinfo here — that's an
# environmental precondition (see required-stack "synced archival"), not a
# product regression.
echo "bitcoin.getinfo never recovered after restart within 120s" >&2
return 1
} }
# ──────────────────────────────────────────────────────────────────── # ────────────────────────────────────────────────────────────────────