Files
mtusi2026lab2/scripts/test-expiry.sh
T

10 lines
616 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
# Проверка expiry: пересоздаёт api с SESSION_TTL_SECONDS=2, гоняет tests_student/test_expiry.py, возвращает штатный TTL.
set -eu
cd "$(dirname "$0")/.."
DC="docker compose --env-file .env"
wait_healthy() { i=0; until [ "$(docker inspect -f '{{.State.Health.Status}}' "$($DC ps -q api)")" = "healthy" ]; do i=$((i+1)); [ $i -le 60 ] || exit 1; sleep 1; done; }
trap 'SESSION_TTL_SECONDS= $DC up -d --force-recreate api >/dev/null; wait_healthy' EXIT
SESSION_TTL_SECONDS=2 $DC up -d --force-recreate api; wait_healthy
(cd tests_student && python3 test_expiry.py 2)