# 2026-10-26 19:30:06 UTC | Собственные тесты (HTTP через LB) | exit 0 | 6.2s
$ python student-tests/run_all.py --base-url http://127.0.0.1:8080

== API, auth, concurrency, idempotency tests (DB/expiry tests skip without their env)
test_chat_list_pagination (test_api.ApiBehaviorTests) ... ok
test_cursor_from_other_chat_returns_400 (test_api.ApiBehaviorTests) ... ok
test_duplicate_username_returns_409 (test_api.ApiBehaviorTests) ... ok
test_empty_message_returns_400 (test_api.ApiBehaviorTests) ... ok
test_malformed_json_returns_400 (test_api.ApiBehaviorTests) ... ok
test_naive_timestamp_cursor_returns_400 (test_api.ApiBehaviorTests) ... ok
test_outsider_cannot_access_chat (test_api.ApiBehaviorTests) ... ok
test_pagination_returns_all_messages_without_duplicates (test_api.ApiBehaviorTests) ... ok
test_password_never_returned (test_api.ApiBehaviorTests) ... ok
test_registration_without_password_returns_400 (test_api.ApiBehaviorTests) ... ok
test_sender_id_in_body_rejected (test_api.ApiBehaviorTests) ... ok
test_short_password_returns_400 (test_api.ApiBehaviorTests) ... ok
test_basic_on_business_endpoint_rejected (test_auth.AuthTests) ... ok
test_login_with_body_rejected (test_auth.AuthTests)
Контракт: вход — только заголовок Basic, без тела. Лишний ввод -> 400, сессии нет. ... ok
test_logout_revokes_only_current_session (test_auth.AuthTests) ... ok
test_malformed_basic_headers (test_auth.AuthTests) ... ok
test_password_with_colon_and_unicode (test_auth.AuthTests) ... ok
test_session_shape_and_token_entropy (test_auth.AuthTests) ... ok
test_unknown_and_garbage_tokens (test_auth.AuthTests) ... ok
test_wrong_password_and_unknown_user_look_the_same (test_auth.AuthTests) ... ok
test_x_user_id_gives_no_access (test_auth.AuthTests) ... ok
test_duplicate_and_missing_caller_rejected (test_concurrency.ChatRollbackTests) ... ok
test_unknown_member_rolls_back_whole_chat (test_concurrency.ChatRollbackTests)
Чат вставляется первым, затем участники по порядку (сначала сам владелец). ... ok
test_same_username_parallel_registration (test_concurrency.RegistrationRaceTests) ... ok
test_session_expires_even_when_cached (test_expiry.ExpiryTests) ... skipped 'set EXPIRY_BASE_URL to the short-TTL API instance'
test_auth_checked_before_key (test_idempotency.IdempotencyTests) ... ok
test_concurrent_same_key_across_replicas_creates_one_message (test_idempotency.IdempotencyTests) ... ok
test_concurrent_same_key_different_bodies_one_winner (test_idempotency.IdempotencyTests) ... ok
test_failed_access_does_not_burn_key (test_idempotency.IdempotencyTests) ... ok
test_json_formatting_and_key_order_do_not_matter (test_idempotency.IdempotencyTests) ... ok
test_key_survives_new_session_of_same_user (test_idempotency.IdempotencyTests) ... ok
test_missing_or_invalid_key_is_400 (test_idempotency.IdempotencyTests) ... ok
test_replay_rechecks_session (test_idempotency.IdempotencyTests) ... ok
test_scope_is_user_and_chat (test_idempotency.IdempotencyTests) ... ok
test_sequential_replay_and_conflict (test_idempotency.IdempotencyTests) ... ok
test_debt_survives_api_restart (test_session_cache.SessionRevocationCacheTests)
Процесс, выполнивший logout, умер до восстановления связи — новый процесс не доверяет кэшу. ... skipped 'DATABASE_URL is not configured'
test_normal_logout_leaves_no_debt (test_session_cache.SessionRevocationCacheTests) ... skipped 'DATABASE_URL is not configured'
test_revoked_token_rejected_after_partition_heals (test_session_cache.SessionRevocationCacheTests) ... skipped 'DATABASE_URL is not configured'
test_cleanup_runs_on_one_replica_at_a_time (test_storage_idempotency.StorageIdempotencyTests) ... skipped 'DATABASE_URL is not configured'
test_conflict_on_different_body (test_storage_idempotency.StorageIdempotencyTests) ... skipped 'DATABASE_URL is not configured'
test_expired_key_can_be_reused_and_is_cleaned (test_storage_idempotency.StorageIdempotencyTests) ... skipped 'DATABASE_URL is not configured'
test_failure_inside_transaction_stores_nothing (test_storage_idempotency.StorageIdempotencyTests) ... skipped 'DATABASE_URL is not configured'
test_threads_same_key_single_insert (test_storage_idempotency.StorageIdempotencyTests) ... skipped 'DATABASE_URL is not configured'
test_failure_after_inserts_leaves_nothing (test_storage_rollback.StorageRollbackTests) ... skipped 'DATABASE_URL is not configured'
test_migrations_are_idempotent (test_storage_rollback.StorageRollbackTests) ... skipped 'DATABASE_URL is not configured'
test_no_orphan_chats_in_database (test_storage_rollback.StorageRollbackTests) ... skipped 'DATABASE_URL is not configured'
test_passwords_stored_as_argon2id (test_storage_rollback.StorageRollbackTests) ... skipped 'DATABASE_URL is not configured'

----------------------------------------------------------------------
Ran 47 tests in 4.640s

OK (skipped=13)

    24 parallel POSTs, one key -> 1 message; replicas: ['a21409fffeec', 'c4c5ae5b0949']

== Concurrent write test
PASS: concurrent write test; 10 clients x 10 messages = 100 messages; no lost or duplicate messages

ALL STUDENT TESTS PASSED
# 2026-10-26 19:30:14 UTC | Тесты с доступом к БД (внутри compose-сети) | exit 0 | 7.5s
$ python scripts/ops.py in-network storage
 Container messenger-lab3-api-run-bdc116a8fd34 Creating 
 Container messenger-lab3-api-run-bdc116a8fd34 Created 
test_cleanup_runs_on_one_replica_at_a_time (test_storage_idempotency.StorageIdempotencyTests.test_cleanup_runs_on_one_replica_at_a_time) ... ok
test_conflict_on_different_body (test_storage_idempotency.StorageIdempotencyTests.test_conflict_on_different_body) ... ok
test_expired_key_can_be_reused_and_is_cleaned (test_storage_idempotency.StorageIdempotencyTests.test_expired_key_can_be_reused_and_is_cleaned) ... ok
test_failure_inside_transaction_stores_nothing (test_storage_idempotency.StorageIdempotencyTests.test_failure_inside_transaction_stores_nothing) ... ok
test_threads_same_key_single_insert (test_storage_idempotency.StorageIdempotencyTests.test_threads_same_key_single_insert) ... ok
test_failure_after_inserts_leaves_nothing (test_storage_rollback.StorageRollbackTests.test_failure_after_inserts_leaves_nothing) ... ok
test_migrations_are_idempotent (test_storage_rollback.StorageRollbackTests.test_migrations_are_idempotent) ... ok
test_no_orphan_chats_in_database (test_storage_rollback.StorageRollbackTests.test_no_orphan_chats_in_database) ... ok
test_passwords_stored_as_argon2id (test_storage_rollback.StorageRollbackTests.test_passwords_stored_as_argon2id) ... ok

----------------------------------------------------------------------
Ran 9 tests in 3.223s

OK
 Container messenger-lab3-api-run-630b208e9588 Creating 
 Container messenger-lab3-api-run-630b208e9588 Created 
test_debt_survives_api_restart (test_session_cache.SessionRevocationCacheTests.test_debt_survives_api_restart)
Процесс, выполнивший logout, умер до восстановления связи — новый процесс не доверяет кэшу. ... logout: cache invalidation deferred; positive cache disabled
ok
test_normal_logout_leaves_no_debt (test_session_cache.SessionRevocationCacheTests.test_normal_logout_leaves_no_debt) ... ok
test_revoked_token_rejected_after_partition_heals (test_session_cache.SessionRevocationCacheTests.test_revoked_token_rejected_after_partition_heals) ... logout: cache invalidation deferred; positive cache disabled
ok

----------------------------------------------------------------------
Ran 3 tests in 1.864s

OK

# 2026-10-26 19:30:27 UTC | Истечение сессии (api-short-ttl, TTL 2 с) | exit 0 | 13.7s
$ python scripts/ops.py in-network expiry
 Container messenger-lab3-redis-1 Running 
 Container messenger-lab3-postgres-1 Running 
 Container messenger-lab3-api-1 Running 
 Container messenger-lab3-api-2 Running 
 Container messenger-lab3-api-short-ttl-1 Creating 
 Container messenger-lab3-api-short-ttl-1 Created 
 Container messenger-lab3-postgres-1 Waiting 
 Container messenger-lab3-postgres-1 Healthy 
 Container messenger-lab3-migrate-1 Starting 
 Container messenger-lab3-migrate-1 Started 
 Container messenger-lab3-migrate-1 Waiting 
 Container messenger-lab3-postgres-1 Waiting 
 Container messenger-lab3-redis-1 Waiting 
 Container messenger-lab3-redis-1 Healthy 
 Container messenger-lab3-postgres-1 Healthy 
 Container messenger-lab3-migrate-1 Exited 
 Container messenger-lab3-api-2 Waiting 
 Container messenger-lab3-api-1 Waiting 
 Container messenger-lab3-api-2 Healthy 
 Container messenger-lab3-api-1 Healthy 
 Container messenger-lab3-api-short-ttl-1 Starting 
 Container messenger-lab3-api-short-ttl-1 Started 
 Container messenger-lab3-api-run-a36baf72714e Creating 
 Container messenger-lab3-api-run-a36baf72714e Created 
ready: http://api-short-ttl:8080/health/ready
 Container messenger-lab3-api-run-c445a7ef00cd Creating 
 Container messenger-lab3-api-run-c445a7ef00cd Created 
test_session_expires_even_when_cached (test_expiry.ExpiryTests.test_session_expires_even_when_cached) ... ok

----------------------------------------------------------------------
Ran 1 test in 3.620s

OK

