Files
ScadaBridge/docs/plans/2026-11-12-leader-auto-down-env2-drill/run-site.sh
T
Joseph Doherty 644f564c30 docs(drill): env2 seeded data-path soak - site-x and central failovers with live data and S&F, no buffered loss (#116)
Unreplicated, the site-x survivor came up empty (by design: no LocalDb peer);
replicated, kill and freeze each lost only the 26-30 s takeover window, every
buffered message was delivered once, and the 4 duplicate ticks came from the
frozen victim's 6 s zombie window. Central kill: 0 gap.

Claude-Session: https://claude.ai/code/session_01GT67ACmpMR7b9LGRPLijMi
2026-11-12 23:56:18 -05:00

24 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# run-site.sh <name> <action kill|pause>: site-x active drill with the sink failing across the hit.
set -u
SP=$(dirname "$0"); WT=~/Desktop/ScadaBridge-wt-env2-seed; D=$WT/docs/plans/2026-11-12-leader-auto-down-env2-drill
NAME=$1; ACT=$2
T0=$(date +%s)
"$SP/sample.sh" 400 5 > "$D/$NAME.metrics" 2>&1 & SPID=$!
sleep 10
echo "$(date -u +%H:%M:%S) sink -> fail" | tee "$D/$NAME.events"
docker exec scadabridge-env2-sfsink sh -c 'echo fail > /data/mode'
sleep 20
echo "$(date -u +%H:%M:%S) drill start ($ACT)" | tee -a "$D/$NAME.events"
( cd $WT && DRILL_ENV=env2 DRILL_PAIR=site-x DRILL_MODE=active DRILL_ACTION=$ACT bash docker/failover-drill.sh ) > "$D/$NAME.log" 2>&1; RC=$?
echo "$(date -u +%H:%M:%S) drill end rc=$RC" | tee -a "$D/$NAME.events"
sleep 5
echo "$(date -u +%H:%M:%S) sink -> ok" | tee -a "$D/$NAME.events"
docker exec scadabridge-env2-sfsink sh -c 'echo ok > /data/mode'
sleep 60
kill $SPID 2>/dev/null
T1=$(( $(date +%s) - 10 ))
echo "$(date -u +%H:%M:%S) done" | tee -a "$D/$NAME.events"
docker exec scadabridge-env2-sfsink cat /data/received.jsonl > "$SP/received.jsonl"
python3 "$SP/analyze.py" "$SP/received.jsonl" "$T0" "$T1" 192.168.147.18 192.168.147.16 | tee "$D/$NAME.ticks"