Files
dingoandClaude Opus 5.5 3a34ae39bc fix: M8 review findings (restore ownership, barrier tool, World0 claimRef, CI selection, drill verdicts)
P1: restore-world.sh claims its objects path (mkdir) and the database (a held
session with a restore try-lock and the exclusive upgrade lock), and removes only
what it created, so a losing restore never drops a winner's schema.
P2: barrier Ready-pod selection via shared jsonpath helper with fixtures; barrier
pod fsGroup; script-generated pods inspected by the policy check; World0 PV claim
references protected; ci-paths.sh uses the event's real base and runs on
uncertainty; fault-drill asserts RTO and needs positive quarantine evidence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 22:53:11 -04:00

39 lines
2.4 KiB
Bash

#!/usr/bin/env bash
# Offline fixtures for the operations helpers (review M8 P2): Ready-pod selection
# (tools/ops/lib/pods.sh) and the fault-drill verdicts (tools/ops/lib/drill.sh). No
# cluster: the lines below are what POD_STATUS_JSONPATH renders as
# "<name>|<Ready status>|<deletionTimestamp>". Run by the ci-deploy image build.
set -euo pipefail
root="$(cd "$(dirname "$0")/../.." && pwd)"
. "$root/tools/ops/lib/pods.sh"
. "$root/tools/ops/lib/drill.sh"
failures=0
expect() { # expect <label> <wanted> <actual>
if [ "$2" = "$3" ]; then echo "ok $1"; else echo "FAIL $1: wanted '$2', got '$3'"; failures=$((failures + 1)); fi
}
pick() { single_ready_pod 2> /dev/null <<< "$1" || echo "<none>"; }
expect "one Ready pod" evo-region-a "$(pick 'evo-region-a|True|')"
expect "not Ready" "<none>" "$(pick 'evo-region-a|False|')"
expect "being deleted" "<none>" "$(pick 'evo-region-a|True|2026-09-30T10:00:00Z')"
expect "no Ready condition yet" "<none>" "$(pick 'evo-region-a||')"
expect "Ready beside a deleting pod" evo-region-b "$(pick $'evo-region-a|True|2026-09-30T10:00:00Z\nevo-region-b|True|')"
expect "two Ready pods" "<none>" "$(pick $'evo-region-a|True|\nevo-region-b|True|')"
expect "no pods" "<none>" "$(pick '')"
expect "jsonpath selects by the Ready condition" 1 \
"$(grep -c 'conditions\[?(@.type=="Ready")\].status' <<< "$POD_STATUS_JSONPATH")"
expect "RTO within budget" PASS "$(rto_verdict 20147 60000)"
expect "RTO just above budget" "FAIL rto 60001 ms > 60000 ms" "$(rto_verdict 60001 60000)"
expect "RTO not measured" "FAIL rto unknown ms > 60000 ms" "$(rto_verdict '' 60000)"
expect "empty: quarantined, exit 4" PASS "$(empty_verdict 2 4 2 6)"
expect "empty: quarantined, still running" PASS "$(empty_verdict 0 '' 1 2)"
expect "empty: crashed otherwise" "FAIL the host exited 1, not 4 (quarantined)" "$(empty_verdict 3 1 0 4)"
expect "empty: image pull, never ran" \
"INCONCLUSIVE the replacement host never ran (Pending, image pull or start failure?)" "$(empty_verdict 0 '' 0 0)"
expect "empty: ran without quarantine" "INCONCLUSIVE the host ran but logged no quarantine" "$(empty_verdict 0 '' 0 3)"
expect "acks covered" PASS "$(acks_verdict 209 209)"
expect "acks lost" "FAIL acknowledged 210 > recovered 209" "$(acks_verdict 210 209)"
expect "acks unobserved" "FAIL acknowledged ? > recovered 209" "$(acks_verdict '' 209)"
[ "$failures" = 0 ] && echo "operations helper fixtures passed" || { echo "$failures fixture(s) failed"; exit 1; }