# Что доказывает: публичный smoke и собственные тесты проходят против # образа на отдельном стенде (свои PostgreSQL, Valkey и volume, пустая # база после миграций); гонки уровня 4 доказаны параллельными клиентами. # Покрыто тестами: неверный JSON (с токеном 400, без токена 401), чужой # чат = несуществующий (404), пустое сообщение, дубликат username, # обход страниц и курсоры, неверный пароль, logout, разбор Basic (UTF-8, # двоеточие, битый base64), Bearer на бизнес-ручках, X-User-Id не даёт # доступа, отозванный токен везде 401, схемы bearerAuth/basicAuth в # OpenAPI, кэш не меняет ответы, X-Request-Id. # Дата (UTC): 2026-10-01T23:18:30Z — 2026-10-01T23:18:42Z # Окружение: macOS 26.6.2, Apple M3 Pro; Docker 29.8.1, Compose 5.5.1; # python3 хоста 3.11.9 (stand.py, smoke), pytest на Python 3.13.15 (uv) # Стенд: student-tests/stand.py isolated — проект vladimirceva-lab2-isolated, # образ mtusi-messenger-vladimirceva:lab2-test; удалён после прогона. # Код src_sha256 8a7e256c540af433. Абсолютный путь заменён на <репозиторий>. # Как повторить: make test-isolated; гонки с выводом — make up, затем # BASE_URL=http://localhost:8080 uv run pytest -rP student-tests/test_race.py $ time make test-isolated python3 student-tests/stand.py isolated [isolated] project=vladimirceva-lab2-isolated [isolated] build image ... [isolated] start postgres and valkey ... [isolated] migrations ... 2026-10-01T23:18:34.821Z INFO alembic.runtime.migration [rid=-] Running upgrade -> 0001, messenger schema: users, sessions, chats, chat members, messages 2026-10-01T23:18:34.830Z INFO src.migrations [rid=-] migrations finished db=messenger [isolated] ready: api=http://127.0.0.1:53216 [isolated] make test python3 tests/smoke.py --base-url "http://127.0.0.1:53216" PASS: lab2 public API scenario; infrastructure and grading evidence remain separate. [isolated] pytest ============================= test session starts ============================== platform darwin -- Python 3.13.15, pytest-9.1.1, pluggy-1.6.0 rootdir: <репозиторий> configfile: pyproject.toml testpaths: student-tests plugins: anyio-4.15.1 collected 66 items / 12 deselected / 54 selected student-tests/test_auth.py ...................... [ 40%] student-tests/test_cache.py .... [ 48%] student-tests/test_race.py .. [ 51%] student-tests/test_request_id.py ....... [ 64%] student-tests/test_rubric.py ................... [100%] ====================== 54 passed, 12 deselected in 4.46s ======================= [isolated] cleanup ... [isolated] results: {'test': 0, 'student-test': 0} real 11.50 user 1.92 sys 0.53 # Smoke PASS и 54 passed; 12 проверок отказов (маркер fault) собраны, но # идут только на своём стенде — tests/failure-checks.txt. $ BASE_URL=http://localhost:8080 uv run pytest -rP student-tests/test_race.py ============================= test session starts ============================== platform darwin -- Python 3.13.15, pytest-9.1.1, pluggy-1.6.0 rootdir: <репозиторий> configfile: pyproject.toml plugins: anyio-4.15.1 collected 2 items student-tests/test_race.py .. [100%] ==================================== PASSES ==================================== ______________________ test_100_messages_from_10_clients _______________________ ----------------------------- Captured stdout call ----------------------------- statuses={201: 100} peak_in_flight=10 history=100 unique_ids=100 pages=[30, 30, 30, 10] __________________ test_parallel_registration_of_one_username __________________ ----------------------------- Captured stdout call ----------------------------- statuses={409: 9, 201: 1} peak_in_flight=10 ============================== 2 passed in 1.18s =============================== # 10 клиентов на своих соединениях стартуют за барьером, в полёте # одновременно все 10: 100 сообщений — 100 ответов 201, в истории ровно 100 # уникальных id в порядке (created_at, id) при обходе страницами по 30. # Гонка регистрации одного username: одна 201, девять 409 — уникальность # держит индекс PostgreSQL (INSERT ... ON CONFLICT DO NOTHING).