Files
mtusi2026lab3/evidence/tests/test-isolated.md
T
ricoromaandClaude Opus 5.5 cb14586a19 docs: retake replicas-lb evidence from a4ca9ef after verify
The stand was recreated from a4ca9ef (make down, make run_docker) and
all evidence of the change was taken again on it: stand, distribution,
LB errors, test-persistence, test-failover for each replica (stop and
kill), stop-one refusals, make test and student_test through the LB,
test_isolated, failure_checks and bench self-checks.

New evidence closes scenarios verify found without proof: a real git
clone on non-default ports, a hung replica (docker pause: DOWN after
7.7 s, in-flight request 504), PostgreSQL outage behind the LB, replica
tests failing against one process, aborted responses via
driver.py kill-inflight. REPORT.md gets the corrected detection
formula, the measured cost of the 1 CPU limit for Argon2id and the new
rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 22:09:15 +03:00

67 lines
5.0 KiB
Markdown
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.
# `make test_isolated`: smoke lab3 и свой набор против одного контейнера
| | |
|---|---|
| Спеки | `student-tests` «Прогон на временной базе» — «Успешный прогон»; «Тесты реплик через балансировщик» — «Против одного процесса»; «Покрытие сценариев основных спеков» — «Сверка покрытия» |
| Change | `replicas-lb`, задачи 6.1 и 7.2 (прогон change `instance-id-idempotency` на `af4bca0` — в истории git этого файла) |
| Дата | 2026-10-10 15:51:47 UTC, 64 с |
| Commit | `a4ca9ef`, рабочее дерево чистое |
| Стенд | образ `mtusi-messenger:lab3` из рабочего дерева на `a4ca9ef`; временная база `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` до и после совпадают (`diff` пуст) |
| Хост | Docker Desktop 29.8.1, macOS arm64; ВМ Docker: 12 CPU, 7,7 GiB RAM; ноутбук от батареи |
## Прогон
```text
$ make test_isolated # exit 0, 64 с
[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
[test_isolated] migrations
Running upgrade -> 16c279725564, added messenger tables
Running upgrade 16c279725564 -> 42bc3b9be38f, added sessions and password hashes
Running upgrade 42bc3b9be38f -> 7652184b7016, added idempotency keys
[test_isolated] start api container
[test_isolated] ready
[test_isolated] make test
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
[test_isolated] make student_test
student-tests/test_api_conventions.py::test_one_instance_id_per_process PASSED [ 5%]
...
student-tests/test_idempotency.py::test_replay_on_other_replica SKIPPED [ 53%]
...
student-tests/test_load_balancing.py::test_one_session_on_several_replicas SKIPPED [ 61%]
student-tests/test_load_balancing.py::test_write_visible_through_other_replica SKIPPED [ 62%]
...
student-tests/test_race.py::test_same_key_at_once PASSED [ 77%]
student-tests/test_race.py::test_same_key_through_replicas SKIPPED (...) [ 78%]
...
==================================== PASSES ====================================
two series of 18 requests: {'7100c439564f': 36}
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 56.34s ================
[test_isolated] cleanup
[test_isolated] results: {'test': 0, 'student_test': 0}
```
- Публичный 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`).
- **Почему 64 с, а не 21 с, как до лимитов.** Контейнер получает лимит
сервиса `api` (1 CPU), а набор и smoke делают около 190 регистраций и
190 входов (`student-test-lb.md`). Каждый — хэш Argon2id с `p=4`,
около 0,14 с под лимитом вместо 0,025 с без него (`../replicas/stand.md`,
«Цена лимита 1 CPU для входа»): примерно 50 с из 56 с pytest. Через LB
те же тесты идут 21 с на двух репликах. Это следствие лимита,
оставленного осознанно (design `replicas-lb`, решение 14), а не
регрессия кода.