#!/bin/sh # Requires Docker Compose, Python 3.9+ and make. Run from a clone or unpacked folder. set -eu cd "$(dirname "$0")/.." export PYTHONUTF8=1 export PYTHONDONTWRITEBYTECODE=1 export BASE_URL="${BASE_URL:-http://localhost:${LAB3_HOST_PORT:-8080}}" chmod +x scripts/restart.sh scripts/stop-one.sh scripts/restore.sh echo "Lab 3 verification $(date -u '+%Y-%m-%dT%H:%M:%SZ')" docker compose --env-file .env config --quiet docker compose --env-file .env up -d --build --wait --wait-timeout 90 make check make test BASE_URL="$BASE_URL" python3 tests/student_tests.py --base-url "$BASE_URL" python3 tests/contract_edge_tests.py --base-url "$BASE_URL" python3 tests/lab3_tests.py --base-url "$BASE_URL" --restart-script scripts/restart.sh state=$(mktemp) trap 'rm -f "$state"' EXIT python3 scripts/operator_state.py --save "$state" make test-persistence BASE_URL="$BASE_URL" ACTION_SCRIPT=scripts/restart.sh python3 scripts/operator_state.py --compare "$state" make test-failover BASE_URL="$BASE_URL" ACTION_SCRIPT=scripts/stop-one.sh TARGET_INSTANCE_ID=$(cat evidence/last-stopped.txt) export TARGET_INSTANCE_ID sh scripts/restore.sh python3 tests/failover_each.py --base-url "$BASE_URL" --action-script scripts/stop-one.sh --restore-script scripts/restore.sh make test BASE_URL="$BASE_URL" echo 'PASS: full Lab 3 verification completed'