test(lifecycle): make the electrumx suite sync-aware instead of sync-destroying
Two problems with running the gate against a mid-initial-sync electrumx: 1. The (now honest) protocol probe can only fail — ElectrumX serves no sessions until it has caught up to its daemon, so the failure names a state nobody can act on. 2. Worse, the destructive stop/start/restart tests actively destroy sync progress: electrumx flushes its DB cache at 1GB, i.e. rarely, and every restart discards all unflushed work back to the last flush. This node spent 8d14h in initial sync largely because gate runs and reboots kept taking hours of progress away — it restarted at 06:16 and resumed from 959,774, the same height it had reported hours earlier. The suite now detects initial sync POSITIVELY — a fresh (<30 min) "our height: N daemon: M" line from electrumx's own log, gap > 10 — and skips the probe and the four destructive tests with the gap named: # skip electrumx initial sync in progress (1672 blocks behind) — ... This is not the container-absent skip trap fixed earlier: absence of the log line means "unknown" and the tests run and fail honestly. Validated against the live mid-sync node: all four guards fired with the real gap; on a synced node the line shows gap 0-1 and everything runs. Unblocks the release gate from waiting hours on a sync it was itself prolonging. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
6193a009de
commit
43a26c9784
@@ -50,6 +50,24 @@ skip_if_not_installed() {
|
||||
container_installed "$1" || skip "$1 not installed on this node"
|
||||
}
|
||||
|
||||
# ElectrumX serves no sessions until its initial sync completes, so the
|
||||
# protocol probe below can only fail mid-sync. Skip with the gap NAMED (a
|
||||
# positively-detected state from a fresh log line, never inferred from
|
||||
# absence). Canonical rationale lives in electrumx.bats next to its twin.
|
||||
skip_if_electrumx_initial_sync() {
|
||||
local line ours daemon
|
||||
line=$(podman logs --tail 400 --since 30m electrumx 2>/dev/null \
|
||||
| grep -E 'our height: [0-9,]+ daemon: [0-9,]+' | tail -1)
|
||||
[[ -z "$line" ]] && return 0
|
||||
ours=$(echo "$line" | grep -oE 'our height: [0-9,]+' | tr -dc '0-9')
|
||||
daemon=$(echo "$line" | grep -oE 'daemon: [0-9,]+' | tr -dc '0-9')
|
||||
[[ -n "$ours" && -n "$daemon" ]] || return 0
|
||||
local gap=$((daemon - ours))
|
||||
if (( gap > 10 )); then
|
||||
skip "electrumx initial sync in progress ($gap blocks behind) — sessions are not served until it catches up"
|
||||
fi
|
||||
}
|
||||
|
||||
# The subset of required_containers actually installed on this node.
|
||||
installed_required_containers() {
|
||||
local c
|
||||
@@ -135,6 +153,7 @@ bitcoin_json() {
|
||||
|
||||
@test "electrumx answers the Electrum protocol (not just an open socket)" {
|
||||
skip_if_not_installed electrumx
|
||||
skip_if_electrumx_initial_sync
|
||||
# A bare connect() to the HOST-published port proves nothing: podman's port
|
||||
# forwarder accepts the TCP handshake even when nothing inside the container
|
||||
# is listening. On 2026-08-09 this test was green while mempool-api was in a
|
||||
|
||||
Reference in New Issue
Block a user