добавлены автоматические тесты аутентификации и отказов

This commit is contained in:
2026-10-08 01:46:43 +03:00
parent d33c50a087
commit 62cb785c63
4 changed files with 476 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
restore_api() {
echo "Restoring API with SESSION_TTL_SECONDS=3600..."
SESSION_TTL_SECONDS=3600 \
docker compose up -d --force-recreate --no-deps api
}
trap restore_api EXIT
echo "Starting API with SESSION_TTL_SECONDS=2..."
SESSION_TTL_SECONDS=2 \
docker compose up -d --force-recreate --no-deps api
echo "Checking API configuration..."
actual_ttl=$(docker compose exec -T api printenv SESSION_TTL_SECONDS)
if [[ "$actual_ttl" != "2" ]]; then
echo "Expected SESSION_TTL_SECONDS=2, got $actual_ttl" >&2
exit 1
fi
echo "Waiting for API readiness..."
ready=false
for attempt in $(seq 1 30); do
if curl --silent --fail \
http://localhost:8080/health/ready > /dev/null; then
ready=true
break
fi
sleep 1
done
if [[ "$ready" != "true" ]]; then
echo "API did not become ready." >&2
exit 1
fi
echo "Running short TTL test..."
python tests_student/test_short_ttl.py
echo "PASS: short session TTL test completed."