forked from mtusi2026/mtusi2026lab4
Уровень 3: - код lab3 перенесён; MinIO (сборка релиза 2025-10-15, по digest) в общем Compose, идемпотентный bootstrap: приватные bucket, отдельный пользователь API с ограниченной политикой - метаданные вложений в PostgreSQL (миграции 0003, 0004), байты в S3; ключ назначает сервер - upload PNG/JPEG: лимиты до чтения/декодирования, MIME по содержимому, проверка целостности, безопасный filename; 201 только после PUT и COMMIT; download потоком через API - attachment_ids в сообщениях (только файлы своего чата, FK в БД) - 503 API больше не повторяется в HAProxy (отказ общей зависимости), S3 не входит в readiness Уровень 4: - 45 тестов вложений: размер, повреждение, подмена MIME, чужой id, файл другого чата, отказы S3/БД - компенсация при сбое COMMIT; слоты загрузки (8 на реплику) против неограниченной памяти - эксперименты: пик RAM при 10-40 одновременных загрузках, оборванная загрузка и сироты; исправлены удержание соединения БД во время загрузки и таймаут отправки в S3 Уровень 5, трек 2: - reconciler: слияние листинга S3 и курсора БД, 7 категорий расхождений, dry-run, grace period, перепроверка перед действием, тормоз --max-deletes, advisory lock; сервис reconciler в Compose - 8 тестов сверки; эксперимент с 70 внедрёнными ошибками на 10 000 объектах (точное обнаружение, безопасное исправление, идемпотентность) и замер стоимости обхода на 1k/10k/50k
108 lines
9.5 KiB
Plaintext
108 lines
9.5 KiB
Plaintext
============================= test session starts =============================
|
||
platform win32 -- Python 3.14.3, pytest-9.1.1, pluggy-1.7.0 -- D:\диск С\Документы\unic\VP\lab4\mtusi2026lab4\.venv\Scripts\python.exe
|
||
rootdir: D:\диск С\Документы\unic\VP\lab4\mtusi2026lab4
|
||
configfile: pytest.ini
|
||
testpaths: student-tests
|
||
plugins: anyio-4.15.1
|
||
collecting ... collected 97 items
|
||
|
||
student-tests/test_attachments_api.py::test_upload_png_and_download_by_other_member PASSED [ 1%]
|
||
student-tests/test_attachments_api.py::test_upload_jpeg_with_unicode_filename PASSED [ 2%]
|
||
student-tests/test_attachments_api.py::test_message_with_attachments_keeps_order_and_is_readable PASSED [ 3%]
|
||
student-tests/test_attachments_api.py::test_missing_attachment_ids_equals_empty_list_for_idempotency PASSED [ 4%]
|
||
student-tests/test_attachments_api.py::test_too_large_file_is_rejected_before_reading PASSED [ 5%]
|
||
student-tests/test_attachments_api.py::test_too_large_stream_without_content_length PASSED [ 6%]
|
||
student-tests/test_attachments_api.py::test_exactly_max_bytes_is_accepted PASSED [ 7%]
|
||
student-tests/test_attachments_api.py::test_pixel_limit_checked_from_header PASSED [ 8%]
|
||
student-tests/test_attachments_api.py::test_corrupted_image_is_415[truncated-png] PASSED [ 9%]
|
||
student-tests/test_attachments_api.py::test_corrupted_image_is_415[png-bad-crc] PASSED [ 10%]
|
||
student-tests/test_attachments_api.py::test_corrupted_image_is_415[truncated-jpeg] PASSED [ 11%]
|
||
student-tests/test_attachments_api.py::test_corrupted_image_is_415[png-signature-only] PASSED [ 12%]
|
||
student-tests/test_attachments_api.py::test_corrupted_image_is_415[text] PASSED [ 13%]
|
||
student-tests/test_attachments_api.py::test_mime_spoofing_is_415[png-as-jpeg] PASSED [ 14%]
|
||
student-tests/test_attachments_api.py::test_mime_spoofing_is_415[jpeg-as-png] PASSED [ 15%]
|
||
student-tests/test_attachments_api.py::test_mime_spoofing_is_415[png-as-text] PASSED [ 16%]
|
||
student-tests/test_attachments_api.py::test_mime_spoofing_is_415[png-as-gif] PASSED [ 17%]
|
||
student-tests/test_attachments_api.py::test_mime_spoofing_is_415[gif-as-png] PASSED [ 18%]
|
||
student-tests/test_attachments_api.py::test_empty_body_is_400 PASSED [ 19%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[a/b.png] PASSED [ 20%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[..\\evil.png] PASSED [ 21%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[a\x00b.png] PASSED [ 22%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[line\nbreak.png] PASSED [ 23%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[tab\t.png] PASSED [ 24%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[ ] PASSED [ 25%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[..] PASSED [ 26%]
|
||
student-tests/test_attachments_api.py::test_dangerous_filename_is_400[xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] PASSED [ 27%]
|
||
student-tests/test_attachments_api.py::test_missing_filename_is_400 PASSED [ 28%]
|
||
student-tests/test_attachments_api.py::test_outsider_cannot_upload_or_read PASSED [ 29%]
|
||
student-tests/test_attachments_api.py::test_unknown_and_unauthenticated PASSED [ 30%]
|
||
student-tests/test_attachments_api.py::test_missing_variant_is_404_and_bad_variant_is_400 PASSED [ 31%]
|
||
student-tests/test_attachments_api.py::test_foreign_attachment_id_in_message_is_404 PASSED [ 32%]
|
||
student-tests/test_attachments_api.py::test_database_rejects_link_to_attachment_of_other_chat PASSED [ 34%]
|
||
student-tests/test_attachments_api.py::test_invalid_message_attachments_are_400[11-ids] PASSED [ 35%]
|
||
student-tests/test_attachments_api.py::test_invalid_message_attachments_are_400[blank-text] PASSED [ 36%]
|
||
student-tests/test_attachments_api.py::test_invalid_message_attachments_are_400[empty-without-attachments] PASSED [ 37%]
|
||
student-tests/test_attachments_api.py::test_invalid_message_attachments_are_400[bad-uuid] PASSED [ 38%]
|
||
student-tests/test_attachments_api.py::test_duplicate_attachment_ids_are_400 PASSED [ 39%]
|
||
student-tests/test_attachments_api.py::test_storage_down_on_upload_is_503_without_metadata PASSED [ 40%]
|
||
student-tests/test_attachments_api.py::test_storage_down_on_download_is_503 PASSED [ 41%]
|
||
student-tests/test_attachments_api.py::test_commit_failure_after_put_deletes_object PASSED [ 42%]
|
||
student-tests/test_attachments_api.py::test_orphan_left_by_failed_compensation_is_removed_only_after_grace PASSED [ 43%]
|
||
student-tests/test_attachments_api.py::test_upload_slots_exhausted_is_503 PASSED [ 44%]
|
||
student-tests/test_attachments_api.py::test_bucket_is_private_outside_api PASSED [ 45%]
|
||
student-tests/test_attachments_api.py::test_api_credentials_cannot_administer_storage PASSED [ 46%]
|
||
student-tests/test_auth_api.py::test_login_returns_session PASSED [ 47%]
|
||
student-tests/test_auth_api.py::test_jwt_payload_contains_sub_exp_jti PASSED [ 48%]
|
||
student-tests/test_auth_api.py::test_wrong_password_and_unknown_user_give_same_401 PASSED [ 49%]
|
||
student-tests/test_auth_api.py::test_malformed_basic_returns_401 PASSED [ 50%]
|
||
student-tests/test_auth_api.py::test_login_with_body_returns_400_and_creates_no_session PASSED [ 51%]
|
||
student-tests/test_auth_api.py::test_password_with_colon_and_unicode PASSED [ 52%]
|
||
student-tests/test_auth_api.py::test_protected_endpoint_requires_bearer PASSED [ 53%]
|
||
student-tests/test_auth_api.py::test_x_user_id_does_not_override_token PASSED [ 54%]
|
||
student-tests/test_auth_api.py::test_forged_token_is_rejected PASSED [ 55%]
|
||
student-tests/test_auth_api.py::test_logout_revokes_only_current_token PASSED [ 56%]
|
||
student-tests/test_auth_api.py::test_session_expires PASSED [ 57%]
|
||
student-tests/test_chats_api.py::test_unknown_member_returns_400_and_nothing_is_saved PASSED [ 58%]
|
||
student-tests/test_chats_api.py::test_created_chat_is_stored_with_members PASSED [ 59%]
|
||
student-tests/test_chats_api.py::test_foreign_chat_returns_404 PASSED [ 60%]
|
||
student-tests/test_chats_api.py::test_member_sees_chat PASSED [ 61%]
|
||
student-tests/test_chats_api.py::test_creator_must_be_member PASSED [ 62%]
|
||
student-tests/test_chats_api.py::test_duplicate_members_return_400 PASSED [ 63%]
|
||
student-tests/test_idempotency_api.py::test_missing_or_invalid_key_returns_400 PASSED [ 64%]
|
||
student-tests/test_idempotency_api.py::test_valid_key_alphabet_and_max_length PASSED [ 65%]
|
||
student-tests/test_idempotency_api.py::test_replay_returns_same_message_without_duplicate PASSED [ 67%]
|
||
student-tests/test_idempotency_api.py::test_json_key_order_and_whitespace_do_not_matter PASSED [ 68%]
|
||
student-tests/test_idempotency_api.py::test_same_key_with_other_body_returns_409 PASSED [ 69%]
|
||
student-tests/test_idempotency_api.py::test_key_scope_is_user_and_chat PASSED [ 70%]
|
||
student-tests/test_idempotency_api.py::test_replay_still_checks_session_and_membership PASSED [ 71%]
|
||
student-tests/test_idempotency_api.py::test_failed_request_does_not_consume_key PASSED [ 72%]
|
||
student-tests/test_idempotency_api.py::test_expired_key_is_reusable PASSED [ 73%]
|
||
student-tests/test_idempotency_api.py::test_concurrent_requests_with_one_key_create_one_message PASSED [ 74%]
|
||
student-tests/test_idempotency_api.py::test_concurrent_different_bodies_one_key_only_one_wins PASSED [ 75%]
|
||
student-tests/test_idempotency_api.py::test_instance_id_header_is_present_and_stable PASSED [ 76%]
|
||
student-tests/test_idempotency_api.py::test_ready_returns_503_while_draining PASSED [ 77%]
|
||
student-tests/test_messages_api.py::test_empty_message_returns_400 PASSED [ 78%]
|
||
student-tests/test_messages_api.py::test_sender_is_taken_from_token PASSED [ 79%]
|
||
student-tests/test_messages_api.py::test_pagination_over_several_pages PASSED [ 80%]
|
||
student-tests/test_messages_api.py::test_cursor_from_another_chat_returns_400 PASSED [ 81%]
|
||
student-tests/test_messages_api.py::test_invalid_limit_returns_400 PASSED [ 82%]
|
||
student-tests/test_reconcile.py::test_detects_both_sides_and_fixes_only_safe_cases PASSED [ 83%]
|
||
student-tests/test_reconcile.py::test_message_cannot_use_attachment_removed_by_reconcile PASSED [ 84%]
|
||
student-tests/test_reconcile.py::test_old_orphans_deleted_and_used_objects_kept PASSED [ 85%]
|
||
student-tests/test_reconcile.py::test_apply_refuses_mass_delete PASSED [ 86%]
|
||
student-tests/test_reconcile.py::test_recheck_keeps_object_whose_metadata_appeared_after_listing PASSED [ 87%]
|
||
student-tests/test_reconcile.py::test_recheck_keeps_row_that_got_referenced PASSED [ 88%]
|
||
student-tests/test_reconcile.py::test_second_run_is_refused_while_first_holds_lock PASSED [ 89%]
|
||
student-tests/test_reconcile.py::test_unordered_stream_aborts PASSED [ 90%]
|
||
student-tests/test_users_api.py::test_invalid_json_returns_400 PASSED [ 91%]
|
||
student-tests/test_users_api.py::test_extra_field_and_wrong_type_return_400 PASSED [ 92%]
|
||
student-tests/test_users_api.py::test_duplicate_username_returns_409 PASSED [ 93%]
|
||
student-tests/test_users_api.py::test_unicode_display_name_is_kept PASSED [ 94%]
|
||
student-tests/test_users_api.py::test_password_is_required_and_length_checked PASSED [ 95%]
|
||
student-tests/test_users_api.py::test_password_is_hashed_and_never_returned PASSED [ 96%]
|
||
student-tests/test_users_api.py::test_me_returns_current_user PASSED [ 97%]
|
||
student-tests/test_users_api.py::test_x_user_id_no_longer_authenticates PASSED [ 98%]
|
||
student-tests/test_users_api.py::test_every_response_has_request_id PASSED [100%]
|
||
|
||
======================= 97 passed in 170.00s (0:02:50) ========================
|