Вложения: приватный S3-bucket (RustFS 1.0.4) + метаданные в PostgreSQL, upload PNG/JPEG с лимитами до декодирования, авторизованный download, attachment_ids в сообщениях, идемпотентный bootstrap bucket, failover/persistence/S3-down тесты и REPORT.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
49 lines
2.4 KiB
Bash
Executable File
49 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
# Повторяемый сбор доказательств уровня 3 lab4 в evidence/ (запуск на хосте из корня, стенд уже поднят).
|
|
# Токены/пароли/ключи S3 в вывод не попадают: тесты их не печатают, hook-вывод подавлен тестом.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
export MSYS_NO_PATHCONV=1 PYTHONUTF8=1
|
|
compose() { docker compose --env-file .env "$@"; }
|
|
tester() { compose --profile tools run --rm tester sh -c "$1" 2>&1 | grep -v '^ Container'; }
|
|
stamp() { echo "# $(date -u +%Y-%m-%dT%H:%M:%SZ), commit $(git rev-parse --short HEAD 2>/dev/null || echo uncommitted)"; }
|
|
mkdir -p evidence
|
|
: > evidence/stop-one.log
|
|
|
|
echo '== stand and S3 bootstrap'
|
|
{ stamp
|
|
compose ps -a --format 'table {{.Name}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}'
|
|
echo; echo '# s3-init (idempotent bucket bootstrap + anonymous access check):'
|
|
compose logs --no-log-prefix s3-init
|
|
echo; echo '# repeated bootstrap run (must not touch existing bucket):'
|
|
compose run --rm -T s3-init 2>&1 | grep -v '^ Container'
|
|
echo; echo '# volumes:'
|
|
docker volume ls --filter label=com.docker.compose.project=mtusi-lab4 --format '{{.Name}}'
|
|
} | tee evidence/stand.txt
|
|
|
|
echo '== public checks'
|
|
{ stamp
|
|
tester 'pip install -q --disable-pip-version-check --root-user-action=ignore -r requirements-dev.txt && make check && make validate PYTHON=python3 && make test'
|
|
} | tee evidence/public-tests.txt
|
|
|
|
echo '== failover: stop-one for each replica (restore between runs)'
|
|
{ stamp
|
|
for i in 1 2 3 4; do
|
|
tester 'make test-failover ACTION_SCRIPT=scripts/stop-one.sh'
|
|
tester 'sh scripts/restore.sh && curl -s -o /dev/null http://lb:8080/health/live'
|
|
[ "$(cut -d' ' -f4 evidence/stop-one.log | sort -u | wc -l)" -ge 2 ] && break
|
|
done
|
|
echo; echo '# evidence/stop-one.log (what the hook really stopped):'; cat evidence/stop-one.log
|
|
} | tee evidence/failover-hook.txt
|
|
|
|
echo '== persistence: restart of lb, api, postgres, s3, valkey with volumes'
|
|
{ stamp
|
|
tester 'make test-persistence ACTION_SCRIPT=scripts/restart.sh'
|
|
echo; echo '# hook scope (StartedAt before/after of every process):'
|
|
sh scripts/restart.sh
|
|
tester 'until curl -fs http://lb:8080/health/ready >/dev/null; do sleep 0.5; done; echo ready'
|
|
} | tee evidence/persistence.txt
|
|
|
|
echo '== student tests (lab4 + lab3/lab2 regression)'
|
|
{ stamp; sh scripts/test-lab4.sh 2>&1 | grep -v '^ Container'; } | tee evidence/student-tests.txt
|