# Тесты отказов: истечение сессии и ключа, остановка Redis и PostgreSQL, откат транзакции, гонки # дата: 2026-10-30T18:50Z, commit: c8a5137 # стенд: Apple M3 Pro, 11 CPU, 18 GB RAM, macOS 26.1, Docker 29.3.0, Compose 5.1.0 $ make test-failures BASE_URL="http://localhost:8080" python3 -m unittest discover -s student-tests/failures -v test_postgres_down (test_dependencies.DependencyDownTest.test_postgres_down) ... ok test_redis_down (test_dependencies.DependencyDownTest.test_redis_down) ... ok test_uncertain_write_can_be_repeated_with_same_key (test_dependencies.DependencyDownTest.test_uncertain_write_can_be_repeated_with_same_key) ... ok test_expires_at_matches_ttl (test_expiry.SessionExpiryTest.test_expires_at_matches_ttl) ... ok test_idempotency_key_is_free_after_ttl (test_expiry.SessionExpiryTest.test_idempotency_key_is_free_after_ttl) ... ok test_login_after_expiry (test_expiry.SessionExpiryTest.test_login_after_expiry) ... ok test_requests_do_not_extend_session (test_expiry.SessionExpiryTest.test_requests_do_not_extend_session) ... ok test_session_expires (test_expiry.SessionExpiryTest.test_session_expires) ... ok test_chat_with_unknown_member_is_rolled_back (test_transactions.TransactionTest.test_chat_with_unknown_member_is_rolled_back) ... ok test_failed_message_leaves_no_key (test_transactions.TransactionTest.test_failed_message_leaves_no_key) ... ok test_migrations_can_be_repeated (test_transactions.TransactionTest.test_migrations_can_be_repeated) ... ok test_password_is_stored_as_argon2id_hash (test_transactions.TransactionTest.test_password_is_stored_as_argon2id_hash) ... ok test_same_key_in_parallel_creates_one_row (test_transactions.TransactionTest.test_same_key_in_parallel_creates_one_row) ... ok test_username_race_creates_one_row (test_transactions.TransactionTest.test_username_race_creates_one_row) ... ok test_valid_chat_is_committed_whole (test_transactions.TransactionTest.test_valid_chat_is_committed_whole) ... ok ---------------------------------------------------------------------- Ran 15 tests in 63.124s OK # время ответа при отказе $ docker compose stop redis; curl /api/v1/users/me с Bearer-токеном {"error":{"code":"unavailable","message":"Сервис временно недоступен","request_id":"fd1ba9633a1f45b2b32edbe8fabcdfc0"}} HTTP 503 за 0.014943 с $ docker compose stop postgres; curl /health/ready {"error":{"code":"unavailable","message":"Сервис временно недоступен","request_id":"60cb3d48d62f46e08603858885711899"}} HTTP 503 за 3.005406 с $ через 4 секунды: реплики исключены, отвечает балансировщик {"error":{"code":"unavailable","message":"Сервис временно недоступен","request_id":"16ca6124-f073-41f0-be0d-f510ed4c067b"}} HTTP 503 за 0.003489 с