diff --git a/tests/integration/lib.sh b/tests/integration/lib.sh index c5f3405..a218276 100644 --- a/tests/integration/lib.sh +++ b/tests/integration/lib.sh @@ -478,23 +478,60 @@ wait_monero_synced() { wait_for "${1:-300}" 10 "Monero sync complete" _pred_mone wait_miner_running() { wait_for "${1:-180}" 5 "miner released" _pred_miner_running; } wait_tari_synced() { wait_for "${1:-300}" 10 "Tari sync complete" _pred_tari_synced; } wait_pool_ready() { wait_for "${1:-180}" 5 "pool type determinate (${2})" _pred_pool_ready "$2"; } -# Assert a pool switch settled, WITHOUT flaking red on peer luck (#687). p2pool infers its sidechain -# from connected peers' ports, so a freshly-switched chain (nano over Tor is the slowest to populate) -# can read "Unknown" past the wait window. A bare assert_eq after `wait_pool_ready … || true` then -# fires cold and fails on a timing state, not a bug. Three-way verdict, same as assert_scenario's -# #454 handling: determinate match → pass; still Unknown/empty → peer-timing WARN; a WRONG determinate -# type (Main when we set Mini) → fail. The 420s window is Tor-realistic; the wait polls, so a fast -# bench that classifies in seconds pays nothing. + +# Ground truth for the sidechain axis (#746): the rendered P2POOL_FLAGS in the box's .env carry +# --mini / --nano (main carries neither). The dashboard classifies the sidechain by counting +# connected peers' ports, so right after a pool SWITCH p2pool runs the NEW flags while the +# classifier can still report the OLD sidechain until enough new-chain peers connect over Tor — +# determinate, wrong, and transient. The flags tell a real render bug apart from that lag. +pool_flags_correct() { # + local flags + flags="$(rx "grep -E '^P2POOL_FLAGS=' .env 2>/dev/null | head -n1 | cut -d= -f2-")" + case "$1" in + Mini) [[ "$flags" == *"--mini"* ]] ;; + Nano) [[ "$flags" == *"--nano"* ]] ;; + *) [[ "$flags" != *"--mini"* && "$flags" != *"--nano"* ]] ;; + esac +} + +# Shared pool-type verdict (#454/#687/#746), used by assert_scenario and assert_pool_switched: +# determinate match → pass; Unknown/empty → peer-timing WARN (nano/Tor is slow to populate); +# determinate-but-wrong with CORRECT P2POOL_FLAGS → classifier-lag WARN (#746, the post-switch +# stale read); wrong type AND wrong flags → a real config/render bug → FAIL. The mismatch path +# now checks the actual flags, so this is a stronger check than the old hard-fail, not a looser one. +assert_pool_type() { #