Лабораторная работа 6

This commit is contained in:
2026-11-13 01:27:57 +03:00
parent 470d9d6f1e
commit 2dbdcf898c
218 changed files with 22057 additions and 37 deletions
+33
View File
@@ -0,0 +1,33 @@
# Локальный прогон (без Docker) — что это и чем НЕ является
Дата: 2026-11-09. Эти файлы получены при разработке в изолированной Linux-песочнице,
где **Docker Hub недоступен** (образы не скачиваются), поэтому compose-стенд там не
поднимался. Те же процессы запускались нативно:
| Роль | В compose.yaml | В локальном прогоне |
| --- | --- | --- |
| API x2 | `api` (образ из Dockerfile) | `python -m src.server` x2 (INSTANCE_ID=api1/api2) |
| LB | HAProxy 2.8.30 | 40-строчный round-robin TCP-прокси на asyncio (только для теста) |
| PostgreSQL | postgres:16.4-alpine | PostgreSQL 16 (системный) |
| Кэш сессий | redis:7.4.1-alpine | Redis 7.0.15, без persistence |
| Broker | redis:7.4.1-alpine, AOF `appendfsync always`, `noeviction` | Redis 7.0.15 с теми же флагами, отдельный dir |
| S3 | SeaweedFS 4.50 | moto 5.0.28 (S3-эмулятор, in-memory) |
| Worker | `worker` (`python -m src.worker`) | тот же модуль; «restart: unless-stopped» эмулирован циклом в shell |
Код приложения, миграции и тесты — те же, что в репозитории. Хуки рестарта/остановки
заменены локальными скриптами (kill/pg_ctl/redis SHUTDOWN), поэтому **доказательства
на compose-стенде нужно собрать самостоятельно**: `python scripts/collect_evidence.py`
(запишет evidence/*.txt и evidence/SUMMARY.txt). S3 в локальном persistence-прогоне
не перезапускался (moto хранит данные в памяти).
| Файл | Что внутри |
| --- | --- |
| smoke.txt, student-tests.txt | `make test` и `student-tests/run_all.py` через 2 реплики: 91 тест + race, PASS |
| pipeline_and_attachments.txt | test_pipeline.py (7) и адаптированный test_attachments.py (17), PASS |
| pipeline_faults.txt | test_pipeline_faults.py: 10 сценариев отказов уровня 4, PASS |
| pipeline_faults_events.txt | журнал job_events этих сценариев (доказательство *как* система восстановилась) |
| worker_fault_log.txt | строки лога worker: внедрённые падения и восстановление своего PEL |
| worker_outage.txt / .json | сценарий защиты уровня 3 (worker stop -> 202 -> рестарт API и broker -> ready) |
| persistence.txt, failover.txt | публичные tests/resilience.py (persistence: API+worker+PG+Redis+broker) |
| latency.json | 30 загрузок: 202 p50 16 мс; до ready p50 0.44 с (с шагом опроса 0.2 с) |
| imaging_memory.txt | пиковый RSS подпроцесса обработки: 40 Мп RGBA PNG — 361 MiB, 40 Мп JPEG — 46 MiB |
+4
View File
@@ -0,0 +1,4 @@
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 141, "failed_attempts": 0, "first_recovery_seconds": 0.115}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
EXIT=0
@@ -0,0 +1,5 @@
synthetic/big.jpg 626630 {'thumbnail': (256, 160), 'crop': (128, 128), 'optimized': (1280, 800)} 0.20s peak RSS 46 MiB
synthetic/big.png 165443 {'thumbnail': (256, 160), 'crop': (128, 128), 'optimized': (1280, 800)} 1.80s peak RSS 361 MiB
tests/fixtures/sample.png 111817 {'thumbnail': (256, 160), 'crop': (128, 128), 'optimized': (320, 200)} 0.05s peak RSS 23 MiB
synthetic/alpha.png 86 {'thumbnail': (50, 30), 'crop': (128, 128), 'optimized': (50, 30)} 0.04s peak RSS 23 MiB
synthetic/orient.jpg 1365 {'thumbnail': (64, 256), 'crop': (128, 128), 'optimized': (100, 400)} 0.04s peak RSS 23 MiB
+14
View File
@@ -0,0 +1,14 @@
{
"n": 30,
"file": "tests/fixtures/sample.png 320x200 109 KiB",
"upload_202_s": {
"p50": 0.016,
"p95": 0.029
},
"upload_to_ready_s": {
"p50": 0.435,
"p95": 0.449,
"max": 0.45
},
"note": "local sandbox, poll interval 0.2 s, 1 worker x 2 consumers"
}
+3
View File
@@ -0,0 +1,3 @@
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
EXIT=0
@@ -0,0 +1,11 @@
.......
----------------------------------------------------------------------
Ran 7 tests in 4.403s
OK
.................
----------------------------------------------------------------------
Ran 17 tests in 3.869s
OK
done
@@ -0,0 +1,18 @@
test_a_crash_between_commit_and_publish (test_pipeline_faults.PipelineFaultTests.test_a_crash_between_commit_and_publish) ... ok
test_b_crash_after_publish_duplicate_is_noop (test_pipeline_faults.PipelineFaultTests.test_b_crash_after_publish_duplicate_is_noop) ... ok
test_c_worker_crash_after_side_effects_before_commit (test_pipeline_faults.PipelineFaultTests.test_c_worker_crash_after_side_effects_before_commit) ... ok
test_d_worker_crash_after_commit_before_ack (test_pipeline_faults.PipelineFaultTests.test_d_worker_crash_after_commit_before_ack) ... ok
test_e_transient_errors_retry_with_backoff (test_pipeline_faults.PipelineFaultTests.test_e_transient_errors_retry_with_backoff) ... ok
test_f_permanent_error_fails_without_retry (test_pipeline_faults.PipelineFaultTests.test_f_permanent_error_fails_without_retry) ... ok
test_g_retry_exhausted_dlq_then_explicit_replay (test_pipeline_faults.PipelineFaultTests.test_g_retry_exhausted_dlq_then_explicit_replay) ... ok
test_h_hung_worker_lease_expires_and_is_fenced (test_pipeline_faults.PipelineFaultTests.test_h_hung_worker_lease_expires_and_is_fenced) ... ok
test_i_staging_removed_after_safe_commit (test_pipeline_faults.PipelineFaultTests.test_i_staging_removed_after_safe_commit) ... /home/claude/venv/lib/python3.13/site-packages/botocore/auth.py:424: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
datetime_now = datetime.datetime.utcnow()
ok
test_j_garbage_broker_message_is_acked (test_pipeline_faults.PipelineFaultTests.test_j_garbage_broker_message_is_acked) ... ok
----------------------------------------------------------------------
Ran 10 tests in 71.328s
OK
EXIT=0
@@ -0,0 +1,71 @@
filename | attempt | event | detail | actor
----------------------------------+---------+-----------------+---------------------------------------------------+-------------
a.png | 1 | accepted | | api
a.png | 1 | fault_injected | crash between COMMIT and publish | api:apipub
a.png | 1 | published | stream id 1794253144786-0 | api:apidup
a.png | 1 | claimed | | wf-1
a.png | 1 | succeeded | thumbnail,crop,optimized | wf-1
b.png | 1 | accepted | | api
b.png | 1 | fault_injected | crash after XADD before outbox commit | api:apidup
b.png | 1 | claimed | | wf-1
b.png | 1 | succeeded | thumbnail,crop,optimized | wf-1
b.png | 1 | published | stream id 1794253148012-0 | api:api1
b.png | 1 | redelivery_noop | already_succeeded | wf-0
fault-crash-after-effects.png | 1 | accepted | | api
fault-crash-after-effects.png | 1 | published | stream id 1794253148173-0 | api:api1
fault-crash-after-effects.png | 1 | claimed | | wf-1
fault-crash-after-effects.png | 1 | fault_injected | crash after S3 writes before COMMIT | wf-1
fault-crash-after-effects.png | 1 | lease_takeover | previous owner wf-1 | wf-1
fault-crash-after-effects.png | 1 | succeeded | thumbnail,crop,optimized | wf-1
fault-crash-before-ack.png | 1 | accepted | | api
fault-crash-before-ack.png | 1 | published | stream id 1794253150245-0 | api:api1
fault-crash-before-ack.png | 1 | claimed | | wf-0
fault-crash-before-ack.png | 1 | succeeded | thumbnail,crop,optimized | wf-0
fault-crash-before-ack.png | 1 | fault_injected | crash after COMMIT before XACK | wf-0
fault-crash-before-ack.png | 1 | redelivery_noop | already_succeeded | wf-0
fault-permanent.png | 1 | accepted | | api
fault-permanent.png | 1 | published | stream id 1794253155274-0 | api:api1
fault-permanent.png | 1 | claimed | | wf-1
fault-permanent.png | 1 | failed | invalid_image; injected permanent failure | wf-1
fault-slow.png | 1 | accepted | | api
fault-slow.png | 1 | published | stream id 1794253167381-0 | api:api1
fault-slow.png | 1 | claimed | | wf-1
fault-slow.png | 1 | lease_expired | owner wf-1; next attempt 2 in 0.51s | worker:wf
fault-slow.png | 1 | redelivery_noop | stale_attempt | wf-0
fault-slow.png | 2 | published | stream id 1794253198039-0 | worker:wf
fault-slow.png | 2 | claimed | | wf-0
fault-slow.png | 2 | succeeded | thumbnail,crop,optimized | wf-0
fault-slow.png | 1 | lease_lost | result not published: lease token no longer valid | wf-1
fault-transient-until-3.png | 1 | accepted | | api
fault-transient-until-3.png | 1 | published | stream id 1794253152182-0 | api:api1
fault-transient-until-3.png | 1 | claimed | | wf-1
fault-transient-until-3.png | 1 | retry_scheduled | injected_transient; next attempt 2 in 0.79s | wf-1
fault-transient-until-3.png | 2 | published | stream id 1794253153023-0 | api:api1
fault-transient-until-3.png | 2 | claimed | | wf-0
fault-transient-until-3.png | 2 | retry_scheduled | injected_transient; next attempt 3 in 1.90s | wf-0
fault-transient-until-3.png | 3 | published | stream id 1794253154959-0 | worker:wf
fault-transient-until-3.png | 3 | claimed | | wf-0
fault-transient-until-3.png | 3 | succeeded | thumbnail,crop,optimized | wf-0
fault-transient-until-replay.png | 1 | accepted | | api
fault-transient-until-replay.png | 1 | published | stream id 1794253155506-0 | api:api1
fault-transient-until-replay.png | 1 | claimed | | wf-0
fault-transient-until-replay.png | 1 | retry_scheduled | injected_transient; next attempt 2 in 0.54s | wf-0
fault-transient-until-replay.png | 2 | published | stream id 1794253156965-0 | worker:wf
fault-transient-until-replay.png | 2 | claimed | | wf-1
fault-transient-until-replay.png | 2 | retry_scheduled | injected_transient; next attempt 3 in 1.97s | wf-1
fault-transient-until-replay.png | 3 | published | stream id 1794253158970-0 | worker:wf
fault-transient-until-replay.png | 3 | claimed | | wf-1
fault-transient-until-replay.png | 3 | retry_scheduled | injected_transient; next attempt 4 in 3.54s | wf-1
fault-transient-until-replay.png | 4 | published | stream id 1794253162979-0 | worker:wf
fault-transient-until-replay.png | 4 | claimed | | wf-1
fault-transient-until-replay.png | 4 | retry_scheduled | injected_transient; next attempt 5 in 2.54s | wf-1
fault-transient-until-replay.png | 5 | published | stream id 1794253165987-0 | worker:wf
fault-transient-until-replay.png | 5 | claimed | | wf-1
fault-transient-until-replay.png | 5 | failed | retry_exhausted; injected_transient | wf-1
fault-transient-until-replay.png | 6 | replayed | operator replay; new attempt 6 | test:replay
fault-transient-until-replay.png | 6 | published | stream id 1794253166991-0 | worker:wf
fault-transient-until-replay.png | 6 | claimed | | wf-0
fault-transient-until-replay.png | 6 | succeeded | thumbnail,crop,optimized | wf-0
fault-transient-until-replay.png | 6 | replay_refused | already succeeded (no duplicate execution) | test:replay
(67 rows)
+1
View File
@@ -0,0 +1 @@
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
+111
View File
@@ -0,0 +1,111 @@
== API, auth, concurrency, idempotency tests (DB/expiry tests skip without their env)
test_chat_list_pagination (test_api.ApiBehaviorTests.test_chat_list_pagination) ... ok
test_cursor_from_other_chat_returns_400 (test_api.ApiBehaviorTests.test_cursor_from_other_chat_returns_400) ... ok
test_duplicate_username_returns_409 (test_api.ApiBehaviorTests.test_duplicate_username_returns_409) ... ok
test_empty_message_returns_400 (test_api.ApiBehaviorTests.test_empty_message_returns_400) ... ok
test_malformed_json_returns_400 (test_api.ApiBehaviorTests.test_malformed_json_returns_400) ... ok
test_naive_timestamp_cursor_returns_400 (test_api.ApiBehaviorTests.test_naive_timestamp_cursor_returns_400) ... ok
test_outsider_cannot_access_chat (test_api.ApiBehaviorTests.test_outsider_cannot_access_chat) ... ok
test_pagination_returns_all_messages_without_duplicates (test_api.ApiBehaviorTests.test_pagination_returns_all_messages_without_duplicates) ... ok
test_password_never_returned (test_api.ApiBehaviorTests.test_password_never_returned) ... ok
test_registration_without_password_returns_400 (test_api.ApiBehaviorTests.test_registration_without_password_returns_400) ... ok
test_sender_id_in_body_rejected (test_api.ApiBehaviorTests.test_sender_id_in_body_rejected) ... ok
test_short_password_returns_400 (test_api.ApiBehaviorTests.test_short_password_returns_400) ... ok
test_crash_between_put_and_commit_dry_run_then_apply_then_noop (test_attachment_consistency.AttachmentConsistencyTests.test_crash_between_put_and_commit_dry_run_then_apply_then_noop) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_fresh_pending_is_kept (test_attachment_consistency.AttachmentConsistencyTests.test_fresh_pending_is_kept) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_missing_object_is_reported_not_deleted (test_attachment_consistency.AttachmentConsistencyTests.test_missing_object_is_reported_not_deleted) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_orphan_object_deleted_only_after_grace (test_attachment_consistency.AttachmentConsistencyTests.test_orphan_object_deleted_only_after_grace) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_pending_cannot_be_attached (test_attachment_consistency.AttachmentConsistencyTests.test_pending_cannot_be_attached) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_ready_and_referenced_are_never_collected (test_attachment_consistency.AttachmentConsistencyTests.test_ready_and_referenced_are_never_collected) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_aborted_upload_leaves_no_row_and_no_object (test_attachment_consistency.UploadFailureTests.test_aborted_upload_leaves_no_row_and_no_object) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_db_failure_after_put_returns_503_and_deletes_object (test_attachment_consistency.UploadFailureTests.test_db_failure_after_put_returns_503_and_deletes_object) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_process_crash_after_put_is_collected_by_gc (test_attachment_consistency.UploadFailureTests.test_process_crash_after_put_is_collected_by_gc) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_s3_put_failure_returns_503_and_compensates (test_attachment_consistency.UploadFailureTests.test_s3_put_failure_returns_503_and_compensates) ... skipped 'DATABASE_URL and S3 settings are not configured'
test_attachment_from_other_chat_is_404_and_nothing_saved (test_attachments.AttachmentTests.test_attachment_from_other_chat_is_404_and_nothing_saved) ... ok
test_content_type_with_parameters_is_accepted (test_attachments.AttachmentTests.test_content_type_with_parameters_is_accepted) ... ok
test_corrupted_images_are_415 (test_attachments.AttachmentTests.test_corrupted_images_are_415) ... ok
test_dangerous_filenames_are_400 (test_attachments.AttachmentTests.test_dangerous_filenames_are_400) ... ok
test_exactly_max_size_is_accepted (test_attachments.AttachmentTests.test_exactly_max_size_is_accepted) ... ok
test_idempotency_includes_attachment_ids (test_attachments.AttachmentTests.test_idempotency_includes_attachment_ids) ... ok
test_invalid_and_unknown_attachment_ids (test_attachments.AttachmentTests.test_invalid_and_unknown_attachment_ids) ... ok
test_jpeg_baseline_and_progressive (test_attachments.AttachmentTests.test_jpeg_baseline_and_progressive) ... ok
test_message_attachment_validation (test_attachments.AttachmentTests.test_message_attachment_validation) ... ok
test_message_with_attachments_visible_to_members (test_attachments.AttachmentTests.test_message_with_attachments_visible_to_members) ... ok
test_mime_spoofing_is_415 (test_attachments.AttachmentTests.test_mime_spoofing_is_415) ... ok
test_original_variant_and_unknown_variants (test_attachments.AttachmentTests.test_original_variant_and_unknown_variants) ... ok
test_outsider_and_unknown_chat_upload_404 (test_attachments.AttachmentTests.test_outsider_and_unknown_chat_upload_404) ... ok
test_png_roundtrip_member_reads_outsider_404 (test_attachments.AttachmentTests.test_png_roundtrip_member_reads_outsider_404) ... ok
test_too_large_chunked_without_content_length (test_attachments.AttachmentTests.test_too_large_chunked_without_content_length) ... ok
test_too_large_with_content_length (test_attachments.AttachmentTests.test_too_large_with_content_length) ... ok
test_too_many_pixels (test_attachments.AttachmentTests.test_too_many_pixels) ... ok
test_basic_on_business_endpoint_rejected (test_auth.AuthTests.test_basic_on_business_endpoint_rejected) ... ok
test_login_with_body_rejected (test_auth.AuthTests.test_login_with_body_rejected)
Контракт: вход — только заголовок Basic, без тела. Лишний ввод -> 400, сессии нет. ... ok
test_logout_revokes_only_current_session (test_auth.AuthTests.test_logout_revokes_only_current_session) ... ok
test_malformed_basic_headers (test_auth.AuthTests.test_malformed_basic_headers) ... ok
test_password_with_colon_and_unicode (test_auth.AuthTests.test_password_with_colon_and_unicode) ... ok
test_session_shape_and_token_entropy (test_auth.AuthTests.test_session_shape_and_token_entropy) ... ok
test_unknown_and_garbage_tokens (test_auth.AuthTests.test_unknown_and_garbage_tokens) ... ok
test_wrong_password_and_unknown_user_look_the_same (test_auth.AuthTests.test_wrong_password_and_unknown_user_look_the_same) ... ok
test_x_user_id_gives_no_access (test_auth.AuthTests.test_x_user_id_gives_no_access) ... ok
test_duplicate_and_missing_caller_rejected (test_concurrency.ChatRollbackTests.test_duplicate_and_missing_caller_rejected) ... ok
test_unknown_member_rolls_back_whole_chat (test_concurrency.ChatRollbackTests.test_unknown_member_rolls_back_whole_chat)
Чат вставляется первым, затем участники по порядку (сначала сам владелец). ... ok
test_same_username_parallel_registration (test_concurrency.RegistrationRaceTests.test_same_username_parallel_registration) ... ok
test_session_expires_even_when_cached (test_expiry.ExpiryTests.test_session_expires_even_when_cached) ... skipped 'set EXPIRY_BASE_URL to the short-TTL API instance'
test_auth_checked_before_key (test_idempotency.IdempotencyTests.test_auth_checked_before_key) ... ok
test_concurrent_same_key_across_replicas_creates_one_message (test_idempotency.IdempotencyTests.test_concurrent_same_key_across_replicas_creates_one_message) ...
24 parallel POSTs, one key -> 1 message; replicas: ['api1', 'api2']
ok
test_concurrent_same_key_different_bodies_one_winner (test_idempotency.IdempotencyTests.test_concurrent_same_key_different_bodies_one_winner) ... ok
test_failed_access_does_not_burn_key (test_idempotency.IdempotencyTests.test_failed_access_does_not_burn_key) ... ok
test_json_formatting_and_key_order_do_not_matter (test_idempotency.IdempotencyTests.test_json_formatting_and_key_order_do_not_matter) ... ok
test_key_survives_new_session_of_same_user (test_idempotency.IdempotencyTests.test_key_survives_new_session_of_same_user) ... ok
test_missing_or_invalid_key_is_400 (test_idempotency.IdempotencyTests.test_missing_or_invalid_key_is_400) ... ok
test_replay_rechecks_session (test_idempotency.IdempotencyTests.test_replay_rechecks_session) ... ok
test_scope_is_user_and_chat (test_idempotency.IdempotencyTests.test_scope_is_user_and_chat) ... ok
test_sequential_replay_and_conflict (test_idempotency.IdempotencyTests.test_sequential_replay_and_conflict) ... ok
test_exif_orientation_applied_and_stripped (test_pipeline.PipelineTests.test_exif_orientation_applied_and_stripped) ... ok
test_fixture_320x200 (test_pipeline.PipelineTests.test_fixture_320x200) ... ok
test_progressive_jpeg (test_pipeline.PipelineTests.test_progressive_jpeg) ... ok
test_result_is_stable_and_private (test_pipeline.PipelineTests.test_result_is_stable_and_private) ... ok
test_small_source_not_upscaled_except_crop (test_pipeline.PipelineTests.test_small_source_not_upscaled_except_crop) ... ok
test_transparency_on_white (test_pipeline.PipelineTests.test_transparency_on_white) ... ok
test_unknown_variant_is_400 (test_pipeline.PipelineTests.test_unknown_variant_is_400) ... ok
test_a_crash_between_commit_and_publish (test_pipeline_faults.PipelineFaultTests.test_a_crash_between_commit_and_publish) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_b_crash_after_publish_duplicate_is_noop (test_pipeline_faults.PipelineFaultTests.test_b_crash_after_publish_duplicate_is_noop) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_c_worker_crash_after_side_effects_before_commit (test_pipeline_faults.PipelineFaultTests.test_c_worker_crash_after_side_effects_before_commit) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_d_worker_crash_after_commit_before_ack (test_pipeline_faults.PipelineFaultTests.test_d_worker_crash_after_commit_before_ack) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_e_transient_errors_retry_with_backoff (test_pipeline_faults.PipelineFaultTests.test_e_transient_errors_retry_with_backoff) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_f_permanent_error_fails_without_retry (test_pipeline_faults.PipelineFaultTests.test_f_permanent_error_fails_without_retry) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_g_retry_exhausted_dlq_then_explicit_replay (test_pipeline_faults.PipelineFaultTests.test_g_retry_exhausted_dlq_then_explicit_replay) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_h_hung_worker_lease_expires_and_is_fenced (test_pipeline_faults.PipelineFaultTests.test_h_hung_worker_lease_expires_and_is_fenced) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_i_staging_removed_after_safe_commit (test_pipeline_faults.PipelineFaultTests.test_i_staging_removed_after_safe_commit) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_j_garbage_broker_message_is_acked (test_pipeline_faults.PipelineFaultTests.test_j_garbage_broker_message_is_acked) ... skipped 'needs API at http://127.0.0.1:8090 and DB/S3/broker env'
test_debt_survives_api_restart (test_session_cache.SessionRevocationCacheTests.test_debt_survives_api_restart)
Процесс, выполнивший logout, умер до восстановления связи — новый процесс не доверяет кэшу. ... skipped 'DATABASE_URL is not configured'
test_normal_logout_leaves_no_debt (test_session_cache.SessionRevocationCacheTests.test_normal_logout_leaves_no_debt) ... skipped 'DATABASE_URL is not configured'
test_revoked_token_rejected_after_partition_heals (test_session_cache.SessionRevocationCacheTests.test_revoked_token_rejected_after_partition_heals) ... skipped 'DATABASE_URL is not configured'
test_cleanup_runs_on_one_replica_at_a_time (test_storage_idempotency.StorageIdempotencyTests.test_cleanup_runs_on_one_replica_at_a_time) ... skipped 'DATABASE_URL is not configured'
test_conflict_on_different_body (test_storage_idempotency.StorageIdempotencyTests.test_conflict_on_different_body) ... skipped 'DATABASE_URL is not configured'
test_expired_key_can_be_reused_and_is_cleaned (test_storage_idempotency.StorageIdempotencyTests.test_expired_key_can_be_reused_and_is_cleaned) ... skipped 'DATABASE_URL is not configured'
test_failure_inside_transaction_stores_nothing (test_storage_idempotency.StorageIdempotencyTests.test_failure_inside_transaction_stores_nothing) ... skipped 'DATABASE_URL is not configured'
test_threads_same_key_single_insert (test_storage_idempotency.StorageIdempotencyTests.test_threads_same_key_single_insert) ... skipped 'DATABASE_URL is not configured'
test_failure_after_inserts_leaves_nothing (test_storage_rollback.StorageRollbackTests.test_failure_after_inserts_leaves_nothing) ... skipped 'DATABASE_URL is not configured'
test_migrations_are_idempotent (test_storage_rollback.StorageRollbackTests.test_migrations_are_idempotent) ... skipped 'DATABASE_URL is not configured'
test_no_orphan_chats_in_database (test_storage_rollback.StorageRollbackTests.test_no_orphan_chats_in_database) ... skipped 'DATABASE_URL is not configured'
test_passwords_stored_as_argon2id (test_storage_rollback.StorageRollbackTests.test_passwords_stored_as_argon2id) ... skipped 'DATABASE_URL is not configured'
----------------------------------------------------------------------
Ran 91 tests in 11.178s
OK (skipped=33)
== Concurrent write test
PASS: concurrent write test; 10 clients x 10 messages = 100 messages; no lost or duplicate messages
ALL STUDENT TESTS PASSED
EXIT=0
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
EXIT=0
@@ -0,0 +1,8 @@
2026-11-09 22:39:08,453 ERROR messenger.worker FAULT_INJECTION: worker exits after S3 writes before COMMIT (job 689dc4ad-bf5d-4d33-a7f4-d557aef94b2a)
22:39:08 wf exited (os._exit(70)); supervisor restarts it like docker restart: unless-stopped
2026-11-09 22:39:09,883 INFO messenger.worker wf-1: recovering own unacked message 1794253148173-0
2026-11-09 22:39:10,530 ERROR messenger.worker FAULT_INJECTION: worker exits after COMMIT before XACK (job 6746ae17-f4cc-48b1-9864-c6e80507c2bf)
22:39:10 wf exited (os._exit(70)); supervisor restarts it like docker restart: unless-stopped
2026-11-09 22:39:11,945 INFO messenger.worker wf-0: recovering own unacked message 1794253150245-0
2026-11-09 22:39:57,386 INFO messenger.worker wf-0: claimed idle message 1794253167381-0 (deliveries=2)
2026-11-09 22:40:12,653 WARNING messenger.worker wf-1: lease lost for job acf17aa8-ef8d-4338-8beb-bd9bab29be8b; result not published (fenced)
@@ -0,0 +1,80 @@
[
{
"seconds": 0.02,
"step": "worker stopped",
"t": 0.14
},
{
"status": 202,
"attachment_id": "3985fc73-5e47-411d-8d68-c44551e77cb9",
"attachment_status": "queued",
"step": "upload accepted",
"t": 0.15
},
{
"metadata_status": "queued",
"content_status": 409,
"message_with_attachment": 201,
"plain_message": 201,
"message_id": "d589ad3f-63a3-4258-a981-701a2a7bfb5e",
"step": "while worker is down",
"t": 3.17
},
{
"length": 1,
"lag": 1,
"pending": 0,
"jobs": {
"succeeded": 32,
"failed": 1,
"queued": 1
},
"outbox_rows": 0,
"step": "broker before restarts",
"t": 3.37
},
{
"seconds": 3.06,
"step": "api replicas restarted",
"t": 6.43
},
{
"seconds": 2.03,
"step": "broker restarted (volume kept)",
"t": 8.46
},
{
"metadata_status": "queued",
"length": 1,
"lag": 1,
"pending": 0,
"jobs": {
"succeeded": 32,
"failed": 1,
"queued": 1
},
"outbox_rows": 0,
"step": "after restarts",
"t": 10.66
},
{
"seconds": 3.01,
"step": "worker started",
"t": 13.67
},
{
"attachment_id": "3985fc73-5e47-411d-8d68-c44551e77cb9",
"variants": [
"thumbnail",
"crop",
"optimized"
],
"thumbnail_jpeg_size": [
256,
160
],
"original_sha256_ok": true,
"step": "ready",
"t": 13.7
}
]
@@ -0,0 +1,11 @@
{"seconds": 0.02, "step": "worker stopped", "t": 0.14}
{"status": 202, "attachment_id": "3985fc73-5e47-411d-8d68-c44551e77cb9", "attachment_status": "queued", "step": "upload accepted", "t": 0.15}
{"metadata_status": "queued", "content_status": 409, "message_with_attachment": 201, "plain_message": 201, "message_id": "d589ad3f-63a3-4258-a981-701a2a7bfb5e", "step": "while worker is down", "t": 3.17}
{"length": 1, "lag": 1, "pending": 0, "jobs": {"succeeded": 32, "failed": 1, "queued": 1}, "outbox_rows": 0, "step": "broker before restarts", "t": 3.37}
{"seconds": 3.06, "step": "api replicas restarted", "t": 6.43}
{"seconds": 2.03, "step": "broker restarted (volume kept)", "t": 8.46}
{"metadata_status": "queued", "length": 1, "lag": 1, "pending": 0, "jobs": {"succeeded": 32, "failed": 1, "queued": 1}, "outbox_rows": 0, "step": "after restarts", "t": 10.66}
{"seconds": 3.01, "step": "worker started", "t": 13.67}
{"attachment_id": "3985fc73-5e47-411d-8d68-c44551e77cb9", "variants": ["thumbnail", "crop", "optimized"], "thumbnail_jpeg_size": [256, 160], "original_sha256_ok": true, "step": "ready", "t": 13.7}
PASS: accepted job survived worker stop + API restart + broker restart and became ready
EXIT=0