Files
mtusi2026lab2/scripts/test-expiry.sh
T
eqktrin 5e89a36878
Skeleton contracts / contracts (pull_request) Canceled after 0s
я надеюсь я исправила поставьте зачет
2026-10-17 01:21:46 +03:00

10 lines
616 B
Bash
Executable File
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)