Files
mtusi2026lab3/evidence/student-test.txt
T
2026-10-15 19:44:46 +03:00

71 lines
6.0 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.
python -m unittest discover -s student-tests -p "test_*.py" -v
test_auth_checked_before_access_and_body (test_api.MessengerApiTest.test_auth_checked_before_access_and_body) ... ok
test_bad_cursor_returns_400 (test_api.MessengerApiTest.test_bad_cursor_returns_400) ... ok
test_chat_list_pagination (test_api.MessengerApiTest.test_chat_list_pagination) ... ok
test_chat_membership_rules (test_api.MessengerApiTest.test_chat_membership_rules) ... ok
test_duplicate_username_returns_409 (test_api.MessengerApiTest.test_duplicate_username_returns_409) ... ok
test_empty_blank_and_too_long_messages_return_400 (test_api.MessengerApiTest.test_empty_blank_and_too_long_messages_return_400) ... ok
test_malformed_json_returns_400 (test_api.MessengerApiTest.test_malformed_json_returns_400) ... ok
test_nul_character_is_stored (test_api.MessengerApiTest.test_nul_character_is_stored) ... ok
test_outsider_gets_404_for_foreign_chat (test_api.MessengerApiTest.test_outsider_gets_404_for_foreign_chat) ... ok
test_pagination_walks_several_pages (test_api.MessengerApiTest.test_pagination_walks_several_pages) ... ok
test_unicode_roundtrip (test_api.MessengerApiTest.test_unicode_roundtrip) ... ok
test_wrong_types_and_extra_fields_return_400 (test_api.MessengerApiTest.test_wrong_types_and_extra_fields_return_400) ... ok
test_bearer_required_on_business_endpoints (test_auth.AuthTest.test_bearer_required_on_business_endpoints) ... ok
test_login_returns_opaque_token_with_expiry (test_auth.AuthTest.test_login_returns_opaque_token_with_expiry) ... ok
test_logout_revokes_only_current_session (test_auth.AuthTest.test_logout_revokes_only_current_session) ... ok
test_malformed_basic_returns_401 (test_auth.AuthTest.test_malformed_basic_returns_401) ... ok
test_password_length_rules (test_auth.AuthTest.test_password_length_rules) ... ok
test_password_with_colon_and_unicode (test_auth.AuthTest.test_password_with_colon_and_unicode) ... ok
test_relogin_after_logout (test_auth.AuthTest.test_relogin_after_logout) ... ok
test_user_never_contains_password (test_auth.AuthTest.test_user_never_contains_password) ... ok
test_wrong_password_and_unknown_user_look_the_same (test_auth.AuthTest.test_wrong_password_and_unknown_user_look_the_same) ... ok
test_x_user_id_does_not_change_identity (test_auth.AuthTest.test_x_user_id_does_not_change_identity) ... ok
test_instance_id_on_errors_and_health (test_balancing.BalancingTest.test_instance_id_on_errors_and_health) ... ok
test_logout_applies_on_every_replica (test_balancing.BalancingTest.test_logout_applies_on_every_replica) ... ok
test_one_session_is_served_by_every_replica (test_balancing.BalancingTest.test_one_session_is_served_by_every_replica) ... ok
test_session_cache_is_shared_between_replicas (test_balancing.BalancingTest.test_session_cache_is_shared_between_replicas) ... ok
test_write_on_one_replica_read_on_another (test_balancing.BalancingTest.test_write_on_one_replica_read_on_another) ... ok
test_failed_request_does_not_burn_key (test_idempotency.IdempotencyTest.test_failed_request_does_not_burn_key) ... ok
test_json_formatting_does_not_matter (test_idempotency.IdempotencyTest.test_json_formatting_does_not_matter) ... ok
test_key_is_required_and_validated (test_idempotency.IdempotencyTest.test_key_is_required_and_validated) ... ok
test_key_scope_is_user_and_chat (test_idempotency.IdempotencyTest.test_key_scope_is_user_and_chat) ... ok
test_parallel_different_bodies_same_key (test_idempotency.IdempotencyTest.test_parallel_different_bodies_same_key) ... ok
test_parallel_same_key_through_replicas_creates_one_message (test_idempotency.IdempotencyTest.test_parallel_same_key_through_replicas_creates_one_message) ... ok
test_replay_rechecks_session_and_access (test_idempotency.IdempotencyTest.test_replay_rechecks_session_and_access) ... ok
test_replay_through_another_replica_returns_same_message (test_idempotency.IdempotencyTest.test_replay_through_another_replica_returns_same_message) ... ok
test_same_key_other_body_is_409 (test_idempotency.IdempotencyTest.test_same_key_other_body_is_409) ... ok
----------------------------------------------------------------------
Ran 36 tests in 11.028s
OK
X-Instance-Id есть в health, 404, 401 и 400
logout через одну реплику -> 401 на ['1c773748bc05', 'aa3dac85e7ed']
20 x GET /users/me с одним токеном -> реплики {'aa3dac85e7ed': 10, '1c773748bc05': 10}; это ID запущенных контейнеров api, повторный вход не нужен
10 x GET /users/me через реплики {'aa3dac85e7ed': 5, '1c773748bc05': 5}: попаданий в кэш +20, промахов +0 — кэш общий
сообщение записала реплика aa3dac85e7ed, сразу прочитали ['1c773748bc05', 'aa3dac85e7ed']
с тем же ключом: сначала 400 (пустой текст), потом 201 — ошибка ключ не заняла
тот же JSON с другими пробелами и переносами -> тот же 201 и то же сообщение
нет ключа, пустой, 129 символов, пробел, '/', кириллица -> 400; 128 символов и ._:- -> 201
тот же ключ у другого пользователя и в другом чате -> независимые сообщения
10 одновременных разных тел с одним ключом: 201 x1, 409 x9, в истории 1 сообщение
20 одновременных POST с одним ключом через реплики {'1c773748bc05': 10, 'aa3dac85e7ed': 10}: все 201 с одним id, в истории 1 сообщение
повтор: посторонний -> 404, после logout -> 401, после нового входа -> то же сообщение
1 запрос + 4 повтора через реплики ['1c773748bc05', 'aa3dac85e7ed']: 201 и то же сообщение, в истории 1
другой текст с тем же ключом -> 409 conflict, второе сообщение не создано