$ python scripts/check_contract.py PASS: offline skeleton structure, local refs and Python syntax; application NOT tested. exit=0 $ python scripts/validate_openapi.py PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested. exit=0 $ python tests/smoke.py --base-url http://127.0.0.1:8080 PASS: lab4 public API scenario; infrastructure and grading evidence remain separate. exit=0 $ python -m unittest discover -s student-tests -p test_api.py -v test_bearer_rules (test_api.AuthTest.test_bearer_rules) ... ok test_concurrent_registration_of_same_username (test_api.AuthTest.test_concurrent_registration_of_same_username) ... ok test_logout_revokes_in_database_and_cache (test_api.AuthTest.test_logout_revokes_in_database_and_cache) ... ok test_password_is_not_exposed_or_stored_plain (test_api.AuthTest.test_password_is_not_exposed_or_stored_plain) ... ok test_register_validation (test_api.AuthTest.test_register_validation) ... ok test_session_shape_entropy_and_logout (test_api.AuthTest.test_session_shape_entropy_and_logout) ... ok test_token_only_stored_as_hash (test_api.AuthTest.test_token_only_stored_as_hash) ... ok test_wrong_password_and_unknown_user_are_indistinguishable (test_api.AuthTest.test_wrong_password_and_unknown_user_are_indistinguishable) ... ok test_chat_creation_is_atomic (test_api.DataTest.test_chat_creation_is_atomic) ... ok test_foreign_chat_empty_message_bad_json (test_api.DataTest.test_foreign_chat_empty_message_bad_json) ... ok test_multi_page_history_and_cursor_binding (test_api.DataTest.test_multi_page_history_and_cursor_binding) ... ok test_parallel_writes_from_many_clients (test_api.DataTest.test_parallel_writes_from_many_clients) ... ok ---------------------------------------------------------------------- Ran 12 tests in 2.711s OK exit=0 $ python -m unittest discover -s student-tests -p test_idempotency.py -v test_concurrent_same_key_creates_exactly_one_message_across_replicas (test_idempotency.IdempotencyTest.test_concurrent_same_key_creates_exactly_one_message_across_replicas) ... ok test_different_body_same_key_is_409 (test_idempotency.IdempotencyTest.test_different_body_same_key_is_409) ... ok test_expired_key_is_reusable_after_ttl (test_idempotency.IdempotencyTest.test_expired_key_is_reusable_after_ttl) ... ok test_key_validation (test_idempotency.IdempotencyTest.test_key_validation) ... ok test_replay_rechecks_session_and_membership (test_idempotency.IdempotencyTest.test_replay_rechecks_session_and_membership) ... ok test_replay_returns_same_message_and_creates_no_duplicate (test_idempotency.IdempotencyTest.test_replay_returns_same_message_and_creates_no_duplicate) ... ok test_scope_is_user_and_chat (test_idempotency.IdempotencyTest.test_scope_is_user_and_chat) ... ok test_semantically_equal_body_is_replayed (test_idempotency.IdempotencyTest.test_semantically_equal_body_is_replayed) ... ok test_session_is_shared_between_replicas_without_relogin (test_idempotency.IdempotencyTest.test_session_is_shared_between_replicas_without_relogin) ... ok ---------------------------------------------------------------------- Ran 9 tests in 1.920s OK exit=0 $ python -m unittest discover -s student-tests -p test_attachments.py -v test_aborted_upload_leaves_nothing (test_attachments.AttachmentTest.test_aborted_upload_leaves_nothing) ... ok test_bucket_is_private_outside_the_api (test_attachments.AttachmentTest.test_bucket_is_private_outside_the_api) ... ok test_corrupted_and_spoofed_files_are_415_not_500 (test_attachments.AttachmentTest.test_corrupted_and_spoofed_files_are_415_not_500) ... ok test_dangerous_filenames_are_400 (test_attachments.AttachmentTest.test_dangerous_filenames_are_400) ... ok test_decompression_bomb_header_is_413 (test_attachments.AttachmentTest.test_decompression_bomb_header_is_413) ... ok test_empty_body_is_400 (test_attachments.AttachmentTest.test_empty_body_is_400) ... ok test_foreign_user_cannot_upload_read_or_download (test_attachments.AttachmentTest.test_foreign_user_cannot_upload_read_or_download) ... ok test_idempotent_replay_with_attachments (test_attachments.AttachmentTest.test_idempotent_replay_with_attachments) ... ok test_message_with_attachments_and_chat_binding (test_attachments.AttachmentTest.test_message_with_attachments_and_chat_binding) ... ok test_png_and_jpeg_roundtrip_with_checksum (test_attachments.AttachmentTest.test_png_and_jpeg_roundtrip_with_checksum) ... ok test_too_large_is_413_and_nothing_is_stored (test_attachments.AttachmentTest.test_too_large_is_413_and_nothing_is_stored) ... ok ---------------------------------------------------------------------- Ran 11 tests in 4.285s OK exit=0 $ python -m unittest discover -s student-tests -p test_topology.py -v test_api_runs_as_non_root (test_topology.TopologyTest.test_api_runs_as_non_root) ... ok test_at_least_two_api_replicas_without_published_ports (test_topology.TopologyTest.test_at_least_two_api_replicas_without_published_ports) ... ok test_no_fixed_container_names (test_topology.TopologyTest.test_no_fixed_container_names) ... ok test_only_lb_is_published_and_only_on_localhost (test_topology.TopologyTest.test_only_lb_is_published_and_only_on_localhost) ... ok test_resource_limits_are_set (test_topology.TopologyTest.test_resource_limits_are_set) ... ok test_stop_grace_period_covers_drain (test_topology.TopologyTest.test_stop_grace_period_covers_drain) ... ok ---------------------------------------------------------------------- Ran 6 tests in 1.649s OK exit=0 $ python -m unittest discover -s student-tests -p test_s3_failures.py -v test_db_failure_after_s3_write_is_compensated (test_s3_failures.S3FailureTest.test_db_failure_after_s3_write_is_compensated) ... ok test_missing_object_is_reported_and_attachment_marked_failed (test_s3_failures.S3FailureTest.test_missing_object_is_reported_and_attachment_marked_failed) ... ok test_orphan_left_by_failed_compensation_is_found_and_cleaned_safely (test_s3_failures.S3FailureTest.test_orphan_left_by_failed_compensation_is_found_and_cleaned_safely) ... ok test_s3_down_gives_503_text_path_keeps_working (test_s3_failures.S3FailureTest.test_s3_down_gives_503_text_path_keeps_working) ... ok ---------------------------------------------------------------------- Ran 4 tests in 189.512s OK exit=0 $ python tests/resilience.py --mode persistence --action-script scripts/restart.cmd --base-url http://127.0.0.1:8080 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 $ python tests/resilience.py --mode failover --action-script scripts/stop-one.cmd --base-url http://127.0.0.1:8080 Executing explicit failover hook; hook output suppressed to avoid leaking secrets. {"observed_instances_before": 2, "successful_writes": 105, "failed_attempts": 0, "first_recovery_seconds": 2.329} PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence. exit=0 $ docker compose --env-file .env start api Container mtusi-lab4-postgres-1 Waiting Container mtusi-lab4-seaweedfs-1 Waiting Container mtusi-lab4-seaweedfs-1 Healthy Container mtusi-lab4-s3-init-1 Starting Container mtusi-lab4-postgres-1 Healthy Container mtusi-lab4-migrate-1 Starting Container mtusi-lab4-migrate-1 Started Container mtusi-lab4-s3-init-1 Started Container mtusi-lab4-s3-init-1 Waiting Container mtusi-lab4-valkey-1 Waiting Container mtusi-lab4-migrate-1 Waiting Container mtusi-lab4-valkey-1 Healthy Container mtusi-lab4-migrate-1 Exited Container mtusi-lab4-s3-init-1 Exited Container mtusi-lab4-api-5 Starting Container mtusi-lab4-api-5 Started exit=0 $ python student-tests/test_expiry.py .. ---------------------------------------------------------------------- Ran 2 tests in 19.361s OK exit=0 $ python student-tests/test_dependencies.py .. ---------------------------------------------------------------------- Ran 2 tests in 19.594s OK exit=0 $ docker compose --env-file .env run --rm -T s3-init Container mtusi-lab4-seaweedfs-1 Running Container mtusi-lab4-seaweedfs-1 Waiting Container mtusi-lab4-seaweedfs-1 Healthy Container mtusi-lab4-s3-init-run-da275e60a199 Creating Container mtusi-lab4-s3-init-run-da275e60a199 Created bucket messenger-attachments уже существует анонимный доступ запрещён (HTTP 403) ключ API ограничен одним bucket (create_bucket отклонён: AccessDenied) bootstrap завершён exit=0 $ docker compose --env-file .env run --rm -T s3-init Container mtusi-lab4-seaweedfs-1 Running Container mtusi-lab4-seaweedfs-1 Waiting Container mtusi-lab4-seaweedfs-1 Healthy Container mtusi-lab4-s3-init-run-cc1f19e0054b Creating Container mtusi-lab4-s3-init-run-cc1f19e0054b Created bucket messenger-attachments уже существует анонимный доступ запрещён (HTTP 403) ключ API ограничен одним bucket (create_bucket отклонён: AccessDenied) bootstrap завершён exit=0 $ python tests/smoke.py --base-url http://127.0.0.1:8080 PASS: lab4 public API scenario; infrastructure and grading evidence remain separate. exit=0