forked from mtusi2026/mtusi2026lab2
26 lines
631 B
Bash
Executable File
26 lines
631 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
cd "$(dirname "$0")/.."
|
|
base_url="${BASE_URL:-http://localhost:8080}"
|
|
python="${PYTHON:-python3}"
|
|
|
|
restore() {
|
|
docker compose up -d --no-deps --force-recreate api >/dev/null
|
|
}
|
|
trap restore EXIT
|
|
|
|
SESSION_TTL_SECONDS=2 docker compose up -d --no-deps --force-recreate api >/dev/null
|
|
|
|
attempt=0
|
|
until curl --fail --silent "$base_url/health/ready" >/dev/null; do
|
|
attempt=$((attempt + 1))
|
|
if [ "$attempt" -ge 30 ]; then
|
|
printf '%s\n' 'API did not become ready for expiry test.' >&2
|
|
exit 1
|
|
fi
|
|
sleep 1
|
|
done
|
|
|
|
"$python" student-tests/lab2_tests.py --base-url "$base_url" --check-expiry
|