Site deploy checks: the /miners row count reads table#bench-current (the regrouped bench), known-failed first (an empty current table reads 0), floor 20
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
28395fe5d8
commit
1ad79979c9
1 changed files with 11 additions and 3 deletions
|
|
@ -17,8 +17,14 @@ set -euo pipefail
|
|||
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:-30}"
|
||||
MINERS_MIN_ROWS="${MINERS_MIN_ROWS:-20}" # the current-class table alone (the datacentre rows sit in their own table since 8 Oct 2026)
|
||||
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
|
||||
miners_rows() { printf '%s' "$1" | python3 -c '
|
||||
import sys,re
|
||||
h=sys.stdin.read(); m=re.search(r"<table[^>]*id=\"bench-current\".*?</table>", h, re.S)
|
||||
print(len(re.findall(r"<tr class=\"row\"", m.group(0))) if m else 0)'; }
|
||||
post_checks() { # one pass: prints the first mismatch as "field: detail" and returns 1, or returns 0 silently
|
||||
local j n idx m rows
|
||||
local nc=(-H 'Cache-Control: no-cache' -H 'Pragma: no-cache')
|
||||
|
|
@ -32,7 +38,7 @@ post_checks() { # one pass: prints the first mismatch as "field: detail" and ret
|
|||
local legal; legal=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE$LEGAL_PAGE?x=$RANDOM" 2>/dev/null) || { echo "$LEGAL_PAGE: not reachable"; return 1; }
|
||||
printf '%s' "$legal" | /usr/bin/grep -qiF -- "$LEGAL_STRING" || { echo "legal string missing on $LEGAL_PAGE: \"$LEGAL_STRING\""; return 1; }
|
||||
local miners; miners=$(curl -fsS "${nc[@]}" --max-time 20 "$SITE/miners?x=$RANDOM" 2>/dev/null) || { echo "miners: not reachable"; return 1; }
|
||||
rows=$(printf '%s' "$miners" | /usr/bin/grep -c '<tr class="row"' || true)
|
||||
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"
|
||||
}
|
||||
|
|
@ -41,7 +47,9 @@ if [ "${1:-}" = --self-test-checks ]; then
|
|||
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
|
||||
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; }
|
||||
echo "post-deploy self-test: a wrong network and a missing index string read RED with the field"
|
||||
[ "$(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 "live site now: $(post_checks 2>&1 || true)"
|
||||
exit 0
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue