forked from mtusi2026/mtusi2026lab2
Source: immutable lab5 snapshot f88e9ba43cdfd7eb6a5a7ae5feb4247b4e820071; forward the allowed diff from 64d5c67. Carry SQLAlchemy, Alembic, reliability fixes, versioned jobs, infrastructure and student tests without changing protected coursework files.
Validation: make check, validate, lint; 515 student tests passed with one Linux-only skip; public smoke with telemetry enabled and repeat migration passed. Stop the owned stack and retain volumes. Preserve the existing OTel work in progress; grade implementation remains a separate phase.
21 lines
872 B
Bash
Executable File
21 lines
872 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
out=${1:-evidence/detection}
|
|
mkdir -p "$out"
|
|
scripts/restore.sh
|
|
replica() { docker compose ps -q "${API_SERVICE:-api}" | head -1; }
|
|
detect() { python3 scripts/probe.py detect "$@"; }
|
|
failed=0
|
|
detect --max 1.5 --within-action --restore scripts/restore.sh --out "$out/sigterm.json" \
|
|
-- docker stop -t "${STOP_TIMEOUT:-7}" "$(replica)" || failed=1
|
|
detect --max 1.5 --restore scripts/restore.sh --out "$out/kill.json" \
|
|
-- docker kill "$(replica)" || failed=1
|
|
hung=$(replica)
|
|
detect --max 3.5 --restore "docker unpause $hung && scripts/lb-wait.sh" --out "$out/pause.json" \
|
|
-- docker pause "$hung" || failed=1
|
|
db=$(docker compose ps -q postgres)
|
|
detect --max 1.5 --until 0 --lb-status 503 --restore "docker start $db && scripts/lb-wait.sh" \
|
|
--out "$out/postgres.json" -- docker stop "$db" || failed=1
|
|
exit "$failed"
|