docs: add replicas-lb evidence and report
Evidence from 4e0cc4e: stand ports, limits and per-service env,
X-Instance-Id distribution and scaling, LB-generated errors,
test-persistence through the LB, test-failover for each replica in stop
and kill modes, stop-one refusals, test runs and bench self-checks.
REPORT.md gains the LB architecture, timeout chain, limits, criteria
rows and defence answers. Coverage exclusions for restart now point to
the lab 3 persistence evidence; stale lab 2 pointers go to
KNOWN_ISSUES.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
# `make test_isolated`: smoke lab3 и свой набор против контейнера
|
||||
# `make test_isolated`: smoke lab3 и свой набор против одного контейнера
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| Спеки | `student-tests` «Прогон на временной базе» — «Успешный прогон»; «Покрытие сценариев основных спеков» — «Сверка покрытия» |
|
||||
| Change | `instance-id-idempotency`, задача 9.1 |
|
||||
| Дата | 2026-10-08 16:46:03 UTC, 21 с |
|
||||
| Commit | `af4bca0` |
|
||||
| Стенд | образ `mtusi-messenger:lab3` из рабочего дерева на `af4bca0`; временная база `test_messenger` в Postgres стенда `mtusi-lab3`, Valkey стенда; отдельный контейнер `mtusi-lab3-test-api` на `127.0.0.1:18088`; один процесс API, без балансировщика |
|
||||
| Рабочий стенд | `make run_docker` запущен (API на `127.0.0.1:8080`), во время прогона не трогался |
|
||||
| Хост | Docker Desktop 29.8.1, macOS arm64; ВМ Docker: 12 CPU, 7,7 GiB RAM; лимиты контейнерам не задавались |
|
||||
| Спеки | `student-tests` «Прогон на временной базе» — «Успешный прогон»; «Тесты реплик через балансировщик» — «Против одного процесса»; «Покрытие сценариев основных спеков» — «Сверка покрытия» |
|
||||
| Change | `replicas-lb`, задача 6.1 (прогон change `instance-id-idempotency` на `af4bca0` — в истории git этого файла) |
|
||||
| Дата | 2026-10-10 15:12:59 UTC, 65 с |
|
||||
| Commit | `4e0cc4e` |
|
||||
| Стенд | образ `mtusi-messenger:lab3` из рабочего дерева на `4e0cc4e`; временная база `test_messenger` в Postgres стенда `mtusi-lab3`, Valkey стенда; отдельный контейнер `mtusi-lab3-test-api` на `127.0.0.1:18088` с лимитами сервиса `api` (1 CPU / 512 MiB); один процесс API без балансировщика, `EXPECT_REPLICAS=1` |
|
||||
| Рабочий стенд | `make run_docker` запущен (HAProxy на `127.0.0.1:8080`, `api` × 2), во время прогона не трогался: состояние и `StartedAt` всех контейнеров `mtusi-lab3` до и после совпадают |
|
||||
| Хост | Docker Desktop 29.8.1, macOS arm64; ВМ Docker: 12 CPU, 7,7 GiB RAM; ноутбук от батареи |
|
||||
|
||||
## Прогон
|
||||
|
||||
```text
|
||||
$ make test_isolated # exit 0, 21 с
|
||||
$ make test_isolated # exit 0, 65 с
|
||||
[test_isolated] database=test_messenger container=mtusi-lab3-test-api base_url=http://127.0.0.1:18088
|
||||
[test_isolated] build image
|
||||
[test_isolated] create database test_messenger
|
||||
@@ -26,63 +26,32 @@ $ make test_isolated # exit 0, 21 с
|
||||
[test_isolated] make test
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
[test_isolated] make student_test
|
||||
collecting ... collected 142 items / 15 deselected / 127 selected
|
||||
BASE_URL=http://127.0.0.1:18088 EXPECT_REPLICAS=1 uv run pytest
|
||||
collecting ... collected 146 items / 15 deselected / 131 selected
|
||||
...
|
||||
coverage: 133 scenarios in 11 specs, 121 tested (16 by make failure_checks), 12 excluded
|
||||
coverage: 135 scenarios in 11 specs, 123 tested (16 by make failure_checks), 12 excluded
|
||||
two series of 18 requests: {'5ce3cbf0541d': 36}
|
||||
race: 10 clients x 10 messages, statuses {201: 100}, max in flight 10; history: 100 messages, 100 unique ids, 4 pages by 30
|
||||
username race: 10 clients, statuses {409: 9, 201: 1}, max in flight 10
|
||||
key race: 10 clients, statuses {201: 10}, max in flight 10; history: 1 messages
|
||||
===================== 127 passed, 15 deselected in 13.25s ======================
|
||||
SKIPPED [1] student-tests/test_idempotency.py:282: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
SKIPPED [1] student-tests/test_load_balancing.py:18: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
SKIPPED [1] student-tests/test_load_balancing.py:34: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
SKIPPED [1] student-tests/test_race.py:169: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
================ 127 passed, 4 skipped, 15 deselected in 55.62s ================
|
||||
[test_isolated] cleanup
|
||||
[test_isolated] results: {'test': 0, 'student_test': 0}
|
||||
```
|
||||
|
||||
Публичный smoke лабы 3 (`tests/smoke.py`, профиль lab3) проверяет
|
||||
`X-Instance-Id` у каждого ответа, повтор с тем же ключом (тот же JSON),
|
||||
409 на другое тело и 400 без ключа. 15 тестов `fault` собраны, но
|
||||
выполняет их только `make failure_checks` (`failure-checks.md`).
|
||||
|
||||
## Тесты лабы 3 в наборе
|
||||
|
||||
```text
|
||||
student-tests/test_api_conventions.py::test_instance_id_on_success_and_error PASSED
|
||||
student-tests/test_api_conventions.py::test_instance_id_on_service_responses PASSED
|
||||
student-tests/test_api_conventions.py::test_one_instance_id_per_process PASSED
|
||||
student-tests/test_contract.py::test_bad_instance_id_fails[None] PASSED
|
||||
student-tests/test_contract.py::test_bad_instance_id_fails[] PASSED
|
||||
student-tests/test_contract.py::test_bad_instance_id_fails[api 1] PASSED
|
||||
student-tests/test_contract.py::test_bad_instance_id_fails[aaaa…(65)] PASSED
|
||||
student-tests/test_idempotency.py::test_no_key PASSED
|
||||
student-tests/test_idempotency.py::test_bad_key PASSED
|
||||
student-tests/test_idempotency.py::test_longest_key PASSED
|
||||
student-tests/test_idempotency.py::test_key_on_other_requests PASSED
|
||||
student-tests/test_idempotency.py::test_replay_same_body PASSED
|
||||
student-tests/test_idempotency.py::test_replay_other_json_spelling PASSED
|
||||
student-tests/test_idempotency.py::test_other_body_conflict PASSED
|
||||
student-tests/test_idempotency.py::test_same_key_other_user PASSED
|
||||
student-tests/test_idempotency.py::test_same_key_other_chat PASSED
|
||||
student-tests/test_idempotency.py::test_replay_with_revoked_token PASSED
|
||||
student-tests/test_idempotency.py::test_replay_with_new_session PASSED
|
||||
student-tests/test_idempotency.py::test_outsider_with_members_key PASSED
|
||||
student-tests/test_idempotency.py::test_no_session_and_no_key PASSED
|
||||
student-tests/test_idempotency.py::test_outsider_without_key PASSED
|
||||
student-tests/test_idempotency.py::test_invalid_body_with_used_key PASSED
|
||||
student-tests/test_idempotency.py::test_invalid_request_keeps_key_free PASSED
|
||||
student-tests/test_race.py::test_same_key_at_once PASSED
|
||||
```
|
||||
|
||||
Кроме них в наборе 103 теста лаб 1–2: все отправки сообщений в них идут
|
||||
с ключом (`Api.post_message`), каждый ответ через `contract.py`
|
||||
проверяется и на `X-Instance-Id`.
|
||||
|
||||
Ожидания тестов идемпотентности проверены и на ошибочном коде (задача
|
||||
7.2, против консольного сервиса, мутации откачены и в коммит не
|
||||
попали):
|
||||
|
||||
| Мутация сервиса | Упали |
|
||||
|---|---|
|
||||
| ключ всегда считается свободным | `test_replay_same_body`, `test_replay_other_json_spelling`, `test_other_body_conflict`, `test_replay_with_new_session`, `test_outsider_with_members_key` |
|
||||
| хэш тела не сравнивается | `test_other_body_conflict` |
|
||||
|
||||
Тест «Одно значение на процесс» верен только против одного процесса,
|
||||
как здесь; стенд с балансировщиком — change `replicas-lb`.
|
||||
- Публичный smoke лабы 3 (`tests/smoke.py`, профиль lab3) проходит на
|
||||
образе этого commit.
|
||||
- 127 тестов прошли, 4 теста реплик пропущены с причиной «one API
|
||||
process»: здесь один контейнер без балансировщика. Их прогон через LB
|
||||
— `student-test-lb.md`.
|
||||
- «Одно значение на процесс» в режиме одного процесса — одно значение
|
||||
на все 36 ответов двух серий.
|
||||
- 15 тестов `fault` собраны, но выполняет их только
|
||||
`make failure_checks` (`failure-checks.md`).
|
||||
- Прогон занял 65 с против 21 с до лимитов: контейнер API получает
|
||||
лимит сервиса `api` (1 CPU), а Argon2id с `p=4` на регистрации и
|
||||
входе каждого тестового пользователя идёт в одной квоте CPU.
|
||||
|
||||
Reference in New Issue
Block a user