57 lines
2.4 KiB
Bash
Executable File
57 lines
2.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Q118 gate: the pipe change-monitor retries a folder read before calling it a
|
|
# failure -- 3 attempts, 2 s apart, the last code named, and a wake rather than
|
|
# a fabricated deletion when every attempt fails.
|
|
#
|
|
# The artifact under repair is NOT in this repository -- the pipe's monitor lives
|
|
# at /root/.hermes/scripts/troupe_pipe_monitor.py because the cron job runs it by
|
|
# host path -- so unlike every other volt gate this one names a host path. That
|
|
# is stated, not hidden (the Q106 host-pin class); moving the monitor into the
|
|
# tree is the pipe's decision, not this item's. Everything the gate grades is the
|
|
# deployed retry loop itself: the fake `curl` sits at the module's real boundary,
|
|
# so no function under test is stubbed.
|
|
#
|
|
# Since the Q69 repair this file is the only place the pin lives: q118_verify.py
|
|
# carries no default module and no typed cache paths, it takes argv[1] or
|
|
# $Q118_MONITOR and refuses with rc 2 when neither names one. Override the
|
|
# subject with Q118_MONITOR=<path>; a host without the monitor still reads rc 2
|
|
# (could not grade), never a green.
|
|
set -u
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
VERIFY="$HERE/q118_verify.py"
|
|
MONITOR="${Q118_MONITOR:-/root/.hermes/scripts/troupe_pipe_monitor.py}"
|
|
|
|
if [ ! -f "$VERIFY" ]; then
|
|
echo "FAIL: verifier missing at $VERIFY" >&2
|
|
exit 2
|
|
fi
|
|
if [ ! -f "$MONITOR" ]; then
|
|
echo "FAIL: could not grade -- monitor missing at $MONITOR (override with Q118_MONITOR)" >&2
|
|
exit 2
|
|
fi
|
|
|
|
out="$(Q118_MONITOR="$MONITOR" python3 "$VERIFY" 2>&1)"
|
|
rc=$?
|
|
printf '%s\n' "$out" | grep -E '^FAIL:|^q118:' || true
|
|
|
|
if [ "$rc" -eq 2 ]; then
|
|
echo "FAIL: could not grade (rc 2) -- see the line above" >&2
|
|
exit 2
|
|
fi
|
|
if [ "$rc" -ne 0 ]; then
|
|
echo "FAIL: rc=$rc -- a leg above is red" >&2
|
|
exit 1
|
|
fi
|
|
if ! printf '%s\n' "$out" | grep -q '^q118: 8 leg(s), 8 passed, 0 fault(s)$'; then
|
|
echo "FAIL: expected 8/8 legs, got: $(printf '%s\n' "$out" | tail -1)" >&2
|
|
exit 1
|
|
fi
|
|
# the host-cache leg must speak about the subject's own declared caches, which the
|
|
# instrument now reads out of the module instead of typing into itself
|
|
if ! printf '%s\n' "$out" | grep -q '^ok host-cache -- declared caches unchanged after the run: [^,]*, '; then
|
|
echo "FAIL: the host-cache leg did not name two declared caches" >&2
|
|
exit 1
|
|
fi
|
|
echo "q118: retry absorbs a transient read, names attempts= and last=, wakes on exhaustion -- OK"
|
|
exit 0
|