site deploy: every served page in SERVED_PAGES must answer 200 after a deploy (/swap, /faucet; the builder pages join as they land), with the known-failed self-test case
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
4d55daf536
commit
93e211bfba
1 changed files with 17 additions and 2 deletions
|
|
@ -18,6 +18,7 @@ LIVE_NETWORK="${LIVE_NETWORK:-igneum-devnet-3}"
|
|||
INDEX_STRINGS=("At launch the strongest chip in our public model" "git.igneum.network/igneum-network/")
|
||||
LEGAL_PAGE="${LEGAL_PAGE:-/litepaper}"; LEGAL_STRING="Not legal advice" # the legal line lives on the litepaper in master's tree (22:16 UK: no commit put it on the index)
|
||||
MINERS_MIN_ROWS="${MINERS_MIN_ROWS:-20}" # the current-class table alone (the datacentre rows sit in their own table since 8 Oct 2026)
|
||||
SERVED_PAGES=(swap "faucet|Devnet 3 faucet" "build|Built to prove every block" "grants|Not legal advice.") # clean URLs every deploy must answer 200 (8 Oct 2026: the DEX lane's /swap, the builder lane's /faucet; /light /receipt /oracle /build /grants join as they land)
|
||||
SITE="${SITE_URL:-https://igneum.network}"
|
||||
# the /miners row count: the rows of the current-class table (table#bench-current, the regrouped bench of 8 Oct 2026; the datacentre
|
||||
# and earlier tables sit under their own ids); known-failed: an empty table reads 0
|
||||
|
|
@ -40,16 +41,30 @@ post_checks() { # one pass: prints the first mismatch as "field: detail" and ret
|
|||
local miners; miners=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE/miners?x=$RANDOM" 2>/dev/null) || { echo "miners: not reachable"; return 1; }
|
||||
rows=$(miners_rows "$miners")
|
||||
[ "${rows:-0}" -ge "$MINERS_MIN_ROWS" ] || { echo "miners rows: ${rows:-0} (want at least $MINERS_MIN_ROWS)"; return 1; }
|
||||
echo "ok: api/live $n, ${#INDEX_STRINGS[@]} index strings, the legal line on $LEGAL_PAGE, $rows miners rows"
|
||||
# the builder-programme pages (8 October 2026): every clean URL in SERVED_PAGES answers 200; a page a lane lands is added here
|
||||
# on its deploy, so a later deploy that loses one reads RED with the path
|
||||
# each entry is "path" or "path|string": the page answers 200 and, when given, carries the string (the lane's own read-back line)
|
||||
local pg path want body code
|
||||
for pg in "${SERVED_PAGES[@]}"; do
|
||||
path="${pg%%|*}"; want=""; case "$pg" in *"|"*) want="${pg#*|}" ;; esac
|
||||
body=$(curl -s -w '\n%{http_code}' "${nc[@]}" --max-time 20 "$SITE/$path?x=$RANDOM" 2>/dev/null) || body=$'\n000'
|
||||
code="${body##*$'\n'}"; body="${body%$'\n'*}"
|
||||
[ "$code" = 200 ] || { echo "page /$path: HTTP $code (want 200)"; return 1; }
|
||||
[ -z "$want" ] || printf '%s' "$body" | /usr/bin/grep -cF -- "$want" >/dev/null || { echo "page /$path: string missing: \"$want\""; return 1; }
|
||||
done
|
||||
echo "ok: api/live $n, ${#INDEX_STRINGS[@]} index strings, the legal line on $LEGAL_PAGE, $rows miners rows, ${#SERVED_PAGES[@]} pages 200"
|
||||
}
|
||||
if [ "${1:-}" = --self-test-checks ]; then
|
||||
# known-failed first: a network constant the live site cannot carry must read RED with the field; then the live read as it stands
|
||||
LIVE_NETWORK="igneum-no-such-network" post_checks >/dev/null 2>&1 && { echo "post-deploy self-test: FAIL: a wrong network passed"; exit 1; }
|
||||
out=$(LIVE_NETWORK="igneum-no-such-network" post_checks 2>&1 || true); case "$out" in "api/live network:"*) ;; *) echo "post-deploy self-test: FAIL: the wrong-network line was '$out'"; exit 1 ;; esac
|
||||
# an array is set inside a subshell, not as a command prefix (a prefix makes it the string "(x)")
|
||||
( SERVED_PAGES=("no-such-page-7f3a"); post_checks >/dev/null 2>&1 ) && { echo "post-deploy self-test: FAIL: a missing page passed"; exit 1; }
|
||||
out=$( SERVED_PAGES=("no-such-page-7f3a"); post_checks 2>&1 || true ); case "$out" in "page /no-such-page-7f3a:"*) ;; *) echo "post-deploy self-test: FAIL: the missing-page line was '$out'"; exit 1 ;; esac
|
||||
INDEX_STRINGS=("no such string on any page 7f3a") LIVE_NETWORK="$(curl -fsS --max-time 20 "$SITE/api/live" | python3 -c 'import sys,json; print(json.load(sys.stdin)["state"]["network"])')" post_checks >/dev/null 2>&1 && { echo "post-deploy self-test: FAIL: a missing index string passed"; exit 1; }
|
||||
[ "$(miners_rows '<table id="bench-current"><tr class="hdr"></tr></table><table id="bench-earlier"><tr class="row"></tr></table>')" = 0 ] || { echo "post-deploy self-test: FAIL: an empty current table did not read 0 rows"; exit 1; }
|
||||
[ "$(miners_rows '<table id="bench-current"><tr class="row"></tr><tr class="detail"></tr><tr class="row"></tr></table>')" = 2 ] || { echo "post-deploy self-test: FAIL: two rows did not read 2"; exit 1; }
|
||||
echo "post-deploy self-test: a wrong network and a missing index string read RED with the field; an empty current table reads 0 rows, two rows read 2"
|
||||
echo "post-deploy self-test: a wrong network, a missing index string and a missing page read RED with the field; an empty current table reads 0 rows, two rows read 2"
|
||||
echo "live site now: $(post_checks 2>&1 || true)"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue