# Тесты отказов: сбой между S3 и БД, отказ S3, приватность bucket, истечение, отказ Redis и PostgreSQL, транзакции # дата: 2026-10-30T20:01Z, чистый clone # стенд: 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_commit_lost_after_s3_put (test_storage.ConsistencyTest.test_commit_lost_after_s3_put) Состояние как после падения между PUT и подтверждением: объект есть, строка pending, клиент не получил 201. ... ok test_grace_period_protects_fresh_upload (test_storage.ConsistencyTest.test_grace_period_protects_fresh_upload) ... ok test_interrupted_upload_leaves_nothing (test_storage.ConsistencyTest.test_interrupted_upload_leaves_nothing) ... ok test_orphan_object_is_removed_only_after_grace (test_storage.ConsistencyTest.test_orphan_object_is_removed_only_after_grace) ... ok test_postgres_lost_during_parallel_uploads (test_storage.ConsistencyTest.test_postgres_lost_during_parallel_uploads) Настоящий сбой: база пропадает, пока идут загрузки. Часть объектов попадает в S3 без подтверждения. ... ok test_ready_attachments_are_never_removed (test_storage.ConsistencyTest.test_ready_attachments_are_never_removed) ... ok test_second_pass_changes_nothing (test_storage.ConsistencyTest.test_second_pass_changes_nothing) ... ok test_bucket_bootstrap_can_be_repeated (test_storage.PrivateBucketTest.test_bucket_bootstrap_can_be_repeated) ... ok test_bucket_is_private_and_api_key_is_limited (test_storage.PrivateBucketTest.test_bucket_is_private_and_api_key_is_limited) ... ok test_no_file_on_api_replica (test_storage.PrivateBucketTest.test_no_file_on_api_replica) ... ok test_failed_upload_is_cleaned (test_storage.S3DownTest.test_failed_upload_is_cleaned) ... ok test_s3_down (test_storage.S3DownTest.test_s3_down) ... 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 27 tests in 301.600s OK подтверждено 6, в S3 без подтверждения 8, после очистки расхождений нет