Files
mtusi2026lab2/evidence/05-failures.txt
T

37 lines
2.8 KiB
Plaintext
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.
# Тесты отказов: истечение сессии, остановка Redis и PostgreSQL, откат транзакции, гонка регистрации
# дата: 2026-10-08T15:55Z, commit: 6473fd0
# стенд: 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_expires_at_matches_ttl (test_expiry.SessionExpiryTest.test_expires_at_matches_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_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_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 11 tests in 47.384s
OK
# время ответа при отказе (после тестов сервисы снова остановлены вручную)
$ docker compose stop redis; curl /api/v1/users/me с Bearer-токеном
{"error":{"code":"unavailable","message":"Сервис временно недоступен","request_id":"ec599bbf80da42ba9410d2bb5fe44408"}}
HTTP 503 за 0.010007 с
$ docker compose stop postgres; curl /health/ready
{"error":{"code":"unavailable","message":"Сервис временно недоступен","request_id":"ff86a9409ca74d1a9207d7efe82e4313"}}
HTTP 503 за 3.015225 с
$ docker compose logs api | grep unavailable | tail -4
api-1 | 2026-10-08 15:55:59,645 WARNING messenger: redis unavailable: ConnectionError request_id=7303c9edcbe8408496ff607945e71893
api-1 | 2026-10-08 15:55:59,653 WARNING messenger: redis unavailable: ConnectionError request_id=0a217c1035f548f0b3a68b9bb0640d3f
api-1 | 2026-10-08 15:56:17,960 WARNING messenger: redis unavailable: ConnectionError request_id=ec599bbf80da42ba9410d2bb5fe44408
api-1 | 2026-10-08 15:56:21,270 WARNING messenger: postgres unavailable: PoolTimeout request_id=ff86a9409ca74d1a9207d7efe82e4313