forked from mtusi2026/mtusi2026lab3
43 lines
2.6 KiB
Bash
43 lines
2.6 KiB
Bash
#!/bin/sh
|
|
# Полный прогон доказательств lab3 на Compose-стенде; вывод — evidence/ (без токенов и паролей).
|
|
# Останавливает/перезапускает контейнеры стенда (failover, restart, отказы БД/Redis, rolling update).
|
|
# Трек 5.1 (≈1 ч) запускается отдельно: make track1 (или SKIP_TRACK1=0 ./scripts/collect-evidence.sh).
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
. scripts/lib.sh
|
|
PY=${PYTHON:-python3}
|
|
B=${BASE_URL:-http://127.0.0.1:8080}
|
|
export BASE_URL=$B TTL_BASE_URL=${TTL_BASE_URL:-http://127.0.0.1:8081}
|
|
mkdir -p evidence
|
|
stamp() { echo "# $(now) commit=$(git rev-parse --short HEAD 2>/dev/null || echo n/a) host=$(uname -srm) cpus=$(getconf _NPROCESSORS_ONLN)"; }
|
|
run() { name=$1; shift; { stamp; echo "\$ $*"; "$@" 2>&1; echo "exit=$?"; } > "evidence/$name.txt" || true; tail -2 "evidence/$name.txt"; }
|
|
|
|
./scripts/init-secrets.sh
|
|
dc --profile ttl up -d --build --wait
|
|
{ stamp; docker version --format 'docker {{.Server.Version}}'; dc version; dc --profile ttl images; dc --profile ttl ps; state; } > evidence/stack.txt 2>&1
|
|
run instances sh -c "for i in 1 2 3 4 5 6; do curl -s -o /dev/null -D - $B/health/live | grep -i x-instance-id; done"
|
|
run make-check make check
|
|
run smoke $PY tests/smoke.py --base-url "$B"
|
|
run test-api $PY student-tests/test_api.py
|
|
run test-idempotency $PY student-tests/test_idempotency.py
|
|
run test-expiry $PY student-tests/test_expiry.py
|
|
run test-cache-race make test-cache-race
|
|
: > evidence/failover-hook.txt
|
|
run failover-1 $PY tests/resilience.py --mode failover --action-script scripts/stop-one.sh --base-url "$B"
|
|
run restore-1 ./scripts/start-replicas.sh
|
|
run failover-2 $PY tests/resilience.py --mode failover --action-script scripts/stop-one.sh --base-url "$B"
|
|
run restore-2 ./scripts/start-replicas.sh
|
|
: > evidence/restart-hook.txt
|
|
run persistence $PY tests/resilience.py --mode persistence --action-script scripts/restart.sh --base-url "$B"
|
|
run test-failures $PY student-tests/test_failures.py
|
|
run migrations-rerun dc run --rm --no-deps migrate
|
|
run lb-failover-series $PY research/lb_experiments.py failover-series --mode both
|
|
: > evidence/rolling-update.txt
|
|
run lb-rolling-update $PY research/lb_experiments.py rolling-update
|
|
run load $PY tests/load.py --base-url "$B" --duration 30 --concurrency 4 --output evidence/load.json
|
|
if [ "${SKIP_TRACK1:-1}" = 0 ]; then
|
|
run track1 env COMPOSE_FILE=compose.yaml:research/compose.track1.yaml $PY research/track1.py run all
|
|
run track1-report $PY research/track1.py report
|
|
fi
|
|
echo "evidence collected in evidence/"
|