docs: record unit-of-work evidence and report
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
# Проверки отказов
|
||||
|
||||
- Команда: `make failure_checks`
|
||||
- Дата: 2026-10-31, 16:05:22–16:44:08 UTC; код выхода 0
|
||||
- Commit: `399da05` (ветка `feat/pipeline-reliability`), рабочее дерево без правок кода (на момент прогона добавлены только файлы `evidence/`)
|
||||
- Дата: 2026-10-31, 20:49–21:30:16 UTC; код выхода 0
|
||||
- Commit: `6ba74b1` (ветка `feat/unit-of-work`), рабочее дерево без правок кода (на момент прогона добавлены только файлы `evidence/`); `student-tests/` от `9efab79` не менялись
|
||||
- Стенд: проект `mtusi-lab5-failures` со своими PostgreSQL, Valkey, S3, RabbitMQ, уборщиком, relay, worker и четырьмя API; рабочий стенд `mtusi-lab5` на время прогона остановлен (хост свободен); стенд отказов и его volumes удалены в конце
|
||||
- Итог: **141 passed, 224 deselected, pytest 2302,16 с (38:22); вся команда 38:45**; журнал PostgreSQL стенда без признаков аварии (`crash markers 0`). «too many clients» 40 и «administrator command» 192 — следы самих проверок (заполнение слотов, остановки PostgreSQL)
|
||||
- С прогона на `e2a6427` (140 проверок) усилен `test_hung_worker_lease_fencing`, прежний его поток стал `test_hung_worker_thawed_after_ready`. Тесты в этом прогоне не правились, временных красных нет
|
||||
- Итог: **141 passed, 224 deselected, pytest 2449,18 с (40:49)**; журнал PostgreSQL стенда без признаков аварии (`crash markers 0`). «too many clients» 32 и «administrator command» 194 — следы самих проверок (заполнение слотов, остановки PostgreSQL)
|
||||
- Change `unit-of-work`: набор не правился, тот же набор на прежнем коде — 141 passed; тесты в этом прогоне не правились, временных красных нет
|
||||
- Параметры: уборщик — grace 20 с, интервал 1 с, плановая сверка выключена; worker — 4 попытки, пауза 4–16 с, срок 10 с, запас аренды 2 с, рендер 8 с / 3 с CPU, graceful 2 с; relay — опрос 0,2 с, повторная публикация через 5 с
|
||||
- Вывод сокращён: убраны лог сборки и шаги compose, адреса API временные, строки `PASSED` свёрнуты в список имён
|
||||
|
||||
@@ -15,10 +15,9 @@
|
||||
[failure_checks] start worker: attempts 4, retry 4–16 s, job timeout 10 s, lease margin 2 s, render 8 s / 3 s CPU, graceful 2 s
|
||||
[failure_checks] start relay: poll 0.2 s, republish after 5 s
|
||||
[failure_checks] pytest -m fault
|
||||
=============== 141 passed, 224 deselected in 2302.16s (0:38:22) ===============
|
||||
[failure_checks] postgres log: 578 lines, crash markers 0; "too many clients" 40, "administrator command" 192
|
||||
=============== 141 passed, 224 deselected in 2449.18s (0:40:49) ===============
|
||||
[failure_checks] postgres log: 573 lines, crash markers 0; "too many clients" 32, "administrator command" 194
|
||||
[failure_checks] results: {'fault': 0, 'postgres': 0}
|
||||
make failure_checks 219,83s user 85,52s system 13% cpu 38:45,66 total
|
||||
```
|
||||
|
||||
## Прошедшие проверки по порядку
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
# Быстрые тесты сервисов
|
||||
|
||||
- Команды: `make service_test`, `make service_test_db`
|
||||
- Дата: 2026-10-31, 21:30:16–21:31:00 UTC; коды выхода 0
|
||||
- Commit: `6ba74b1` (ветка `feat/unit-of-work`), рабочее дерево без правок кода (добавлены только файлы `evidence/`)
|
||||
- Стенд: `service_test` — без хранилищ и docker; тот же результат с `DATABASE__PORT=1 CACHE__PORT=1 S3__PORT=1` снят на рабочем дереве задачи 8.2. `service_test_db` — временная база `test_uow_messenger` в PostgreSQL стенда, после прогона баз `test_uow_*` нет (`pg_database`: 0), рабочая база не затронута
|
||||
- Контракт repo: 39 проверок и на фейке, и на SQL (`service-tests/repo_contract.py`)
|
||||
- Сравнение покрытия: блокировки и конкуренцию доказывает только `make failure_checks` (`evidence/tests/failure-checks.md`)
|
||||
|
||||
```text
|
||||
uv run pytest -c service-tests/pytest.ini service-tests/unit
|
||||
200 passed in 1.48s
|
||||
uv run pytest -c service-tests/pytest.ini service-tests/db
|
||||
71 passed in 21.51s
|
||||
```
|
||||
|
||||
## Регрессии задачи 11.7: тесты ловят нарушение
|
||||
|
||||
Сняты до commit на рабочем дереве (design change `unit-of-work`, «Уточнения apply»): каждая регрессия внесена, показана красным прогоном и откатана, хэш `src` совпал со снимком до них, в commit не вошла.
|
||||
|
||||
| Регрессия | Цель | Какой тест красный |
|
||||
|---|---|---|
|
||||
| автокоммит при выходе из блока | `service_test_db` | `test_uow.py::test_exit_without_commit` |
|
||||
| компенсация без флага | `service_test` | `test_attachment_service.py::test_failure_on_commit_keeps_object` |
|
||||
| отметка публикации отдельным блоком | `service_test` | `test_attachment_relay.py::test_publish_order_in_one_block` |
|
||||
| DELETE уборщика после commit | `service_test` | `test_attachment_cleanup.py::test_two_blocks_object_before_row`, `test_storage_failure_keeps_mark_and_row`, `test_row_delete_failure_rolls_back_second_block` |
|
||||
| откат вне срока | `service_test_db` | `test_uow.py::test_frozen_on_rollback` |
|
||||
| без ветки `CancelledError` | `service_test_db` | `test_uow.py::test_cancel_with_open_transaction` |
|
||||
| без `request_deadline` | `service_test_db` | `test_request_flow.py::test_two_slow_steps_fit_single_deadline`, `test_hash_queue_gets_deadline` |
|
||||
| условие `updated_at = created_at` убрано из SQL `mark_queued` | `service_test_db` (на фейке зелено) | `test_repo_contract_sql[check_mark_queued_marked_row]` |
|
||||
| импорт SQLAlchemy в сервис | `service_test` | `test_architecture.py::test_no_forbidden_imports`: `src/core/services/user.py:3 imports sqlalchemy` |
|
||||
| метод порта без фейка | `service_test` | `test_port_implementation_fake_match[AbstractUserRepository]`: `SqlAlchemyUserRepository.get_user_probe`, `FakeUserRepository.get_user_probe` |
|
||||
| `put` worker внутри блока | `service_test` | `test_attachment_processing.py::test_put_is_not_inside_a_block`, `test_ready_and_variants_one_block`, `test_success_commits_ready_with_variants` |
|
||||
| `_connection` адаптера переименован в `_ping_once` | `service_test_db` | `test_ping_detects_dropped_connection_through_proxy`, `test_ping_is_one_exchange` |
|
||||
| `_handle_exception` адаптера переименован в `_ping_once` | `service_test_db` | `test_ping_detects_dropped_connection_through_proxy` |
|
||||
|
||||
Две проверки сначала не ловили нарушение и были исправлены до commit, регрессии повторены: откат вне срока вешал тест, теперь прокси размораживает сторож; метод порта без фейка оставался зелёным, унаследованный абстрактный метод считался реализацией.
|
||||
@@ -1,39 +1,21 @@
|
||||
# Свой набор через LB
|
||||
|
||||
- Команда: `make student_test` (`BASE_URL=http://localhost:8080 EXPECT_REPLICAS=2`)
|
||||
- Дата: 2026-10-31, 13:29:48–13:31:06 UTC; код выхода 2 (код pytest 1)
|
||||
- Commit: `e2a6427` (ветка `feat/pipeline-reliability`), рабочее дерево без правок кода (добавлены только файлы `evidence/`)
|
||||
- Дата: 2026-10-31, 20:39:36–20:41:09 UTC; код выхода 2 (код pytest 1)
|
||||
- Commit: `6ba74b1` (ветка `feat/unit-of-work`), рабочее дерево без правок кода (добавлены только файлы `evidence/`)
|
||||
- Стенд: проект compose `mtusi-lab5`, две реплики за HAProxy, relay, worker, собран `make run_docker` из `HEAD`
|
||||
- Итог: **1 failed, 218 passed, 140 deselected, 77,81 с**. 140 deselected — проверки отказов (`evidence/tests/failure-checks.md`)
|
||||
- Единственное красное — `test_exclusion_evidence_exists`, причина ровно `missing_evidence`: файлы старых исключений `evidence/cache/hits.md`, `evidence/auth/passwords-and-tokens.md`, `evidence/idempotency/replay-after-restart.md` снимаются на последнем шаге всего прогона лабы (`QUESTIONS.md`, «Перенос из лабы 4»). Приложение тут ни при чём: проверяется наличие файла в репозитории
|
||||
- Сверка покрытия: 370 сценариев в 16 спеках, 348 проверены (163 — `make failure_checks`), 22 исключения; «no test and no exclusion» и «unknown scenario» нет
|
||||
- Итог: **1 failed, 223 passed, 141 deselected, 92,33 с**. 141 deselected — проверки отказов (`evidence/tests/failure-checks.md`)
|
||||
- Единственное красное — ожидаемое `test_exclusion_evidence_exists`, причина ровно `missing_evidence`: файлы старых исключений `evidence/cache/hits.md`, `evidence/auth/passwords-and-tokens.md`, `evidence/idempotency/replay-after-restart.md` снимаются на последнем шаге всего прогона лабы (`QUESTIONS.md`, «Перенос из лабы 4»). Приложение тут ни при чём: проверяется наличие файла в репозитории
|
||||
- `student-tests/` с change `unit-of-work` не менялись (`git diff --stat` пуст): набор доказывает, что поведение то же
|
||||
- Вывод сокращён: убраны строки `PASSED`, заголовки блоков вывода и текст функции теста
|
||||
|
||||
```text
|
||||
collecting ... collected 359 items / 140 deselected / 219 selected
|
||||
student-tests/test_coverage.py::test_exclusion_evidence_exists FAILED [ 49%]
|
||||
|
||||
=================================== FAILURES ===================================
|
||||
________________________ test_exclusion_evidence_exists ________________________
|
||||
student-tests/test_coverage.py::test_exclusion_evidence_exists FAILED [ 50%]
|
||||
E AssertionError: exclusion refers to missing evidence/cache/hits.md: chat-cache / Временная база
|
||||
E exclusion refers to missing evidence/cache/hits.md: chat-cache / Срок записи
|
||||
E exclusion refers to missing evidence/cache/hits.md: chat-cache / Чтение из кэша
|
||||
E exclusion refers to missing evidence/idempotency/replay-after-restart.md: idempotency / Повтор после рестарта API
|
||||
E exclusion refers to missing evidence/auth/passwords-and-tokens.md: sessions / Токена нет в хранилище
|
||||
E exclusion refers to missing evidence/auth/passwords-and-tokens.md: users / Хэш в БД
|
||||
|
||||
==================================== PASSES ====================================
|
||||
test_one_instance_id_per_process: two series of 18 requests: {'d7f1b8c394b9': 18, 'e933a5daf6b3': 18}
|
||||
test_attachment_becomes_ready: ready in 0.42 s
|
||||
test_download_through_other_replica: uploaded via e933a5daf6b3, downloaded via ['d7f1b8c394b9', 'e933a5daf6b3']
|
||||
test_every_scenario_is_covered: coverage: 370 scenarios in 16 specs, 348 tested (163 by make failure_checks), 22 excluded
|
||||
test_replay_on_other_replica: sent via e933a5daf6b3, replayed via ['d7f1b8c394b9']; 409 via ['d7f1b8c394b9', 'e933a5daf6b3']
|
||||
test_one_session_on_several_replicas: one session, 20 requests: {'d7f1b8c394b9': 10, 'e933a5daf6b3': 10}
|
||||
test_write_visible_through_other_replica: written via e933a5daf6b3, read via {'d7f1b8c394b9': 3, 'e933a5daf6b3': 3}
|
||||
test_hundred_messages_from_ten_clients: race: 10 clients x 10 messages, statuses {201: 100}, max in flight 10; history: 100 messages, 100 unique ids, 4 pages by 30
|
||||
test_same_username_at_once: username race: 10 clients, statuses {409: 9, 201: 1}, max in flight 10
|
||||
test_same_key_at_once: key race: 10 clients, statuses {201: 10}, max in flight 10; history: 1 messages
|
||||
test_same_key_through_replicas: key race: 10 clients, statuses {201: 10}, max in flight 10; history: 1 messages; key race through replicas: {'e933a5daf6b3': 5, 'd7f1b8c394b9': 5}
|
||||
=========== 1 failed, 218 passed, 140 deselected in 77.81s (0:01:17) ===========
|
||||
make: *** [student_test] Error 1
|
||||
=========== 1 failed, 223 passed, 141 deselected in 92.33s (0:01:32) ===========
|
||||
```
|
||||
|
||||
@@ -1,41 +1,31 @@
|
||||
# Набор на временной базе
|
||||
|
||||
- Команда: `make test_isolated`
|
||||
- Дата: 2026-10-31, 13:34:20–13:36:55 UTC; код выхода 2 (`results: {'test': 0, 'student_test': 2}`)
|
||||
- Commit: `e2a6427` (ветка `feat/pipeline-reliability`), рабочее дерево без правок кода (добавлены только файлы `evidence/`)
|
||||
- Дата: 2026-10-31, 20:36:52–20:39:36 UTC; код выхода 2 (`results: {'test': 0, 'student_test': 2}`)
|
||||
- Commit: `6ba74b1` (ветка `feat/unit-of-work`), рабочее дерево без правок кода (добавлены только файлы `evidence/`)
|
||||
- Стенд: образ из рабочего дерева, контейнеры `mtusi-lab5-test-api`, `mtusi-lab5-test-worker`, `mtusi-lab5-test-relay` на базе `test_messenger` поверх хранилищ рабочего стенда, один процесс API, `EXPECT_REPLICAS=1`
|
||||
- Итог: smoke — `PASS: lab5`; набор — **1 failed, 212 passed, 6 skipped, 140 deselected, 129,89 с**
|
||||
- Итог: smoke — `PASS: lab5`; набор — **1 failed, 217 passed, 6 skipped, 141 deselected, 135,58 с**
|
||||
- 6 skipped — тесты реплик против одного процесса, причина напечатана
|
||||
- Красное — `test_exclusion_evidence_exists`, только `missing_evidence` по трём файлам последнего шага прогона лабы; разбор — `evidence/tests/student-test-lb.md`
|
||||
- После уборки (проверено отдельно): контейнеров `*-test-*` нет, базы `test_messenger` нет (`pg_database`: `postgres`, `messenger`, `template1`, `template0`), очереди временной базы нет (`list_queues`: только `messenger.attachment.process.v1`)
|
||||
- Красное — ожидаемое `test_exclusion_evidence_exists`, только `missing_evidence` по трём файлам, которые снимаются на последнем шаге прогона лабы: `evidence/cache/hits.md`, `evidence/auth/passwords-and-tokens.md`, `evidence/idempotency/replay-after-restart.md`; разбор — `evidence/tests/student-test-lb.md`
|
||||
- Вывод сокращён: убраны лог сборки, строки `PASSED` и журналы контейнеров, которые цель печатает при коде ≠ 0
|
||||
|
||||
```text
|
||||
[test_isolated] database=test_messenger objects=/buckets/messenger/test_messenger/ queue=test_messenger.attachment.process.v1 containers=mtusi-lab5-test-api mtusi-lab5-test-worker mtusi-lab5-test-relay base_url=http://127.0.0.1:18088
|
||||
[test_isolated] remove objects /buckets/messenger/test_messenger/ and queue test_messenger.attachment.process.v1
|
||||
[test_isolated] build image
|
||||
[test_isolated] create database test_messenger
|
||||
[test_isolated] migrations
|
||||
[test_isolated] start api container
|
||||
[test_isolated] start worker container
|
||||
[test_isolated] start relay container
|
||||
[test_isolated] ready
|
||||
[test_isolated] make test
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
|
||||
[test_isolated] make student_test
|
||||
E AssertionError: exclusion refers to missing evidence/cache/hits.md: chat-cache / Временная база
|
||||
E exclusion refers to missing evidence/cache/hits.md: chat-cache / Срок записи
|
||||
E exclusion refers to missing evidence/cache/hits.md: chat-cache / Чтение из кэша
|
||||
E exclusion refers to missing evidence/idempotency/replay-after-restart.md: idempotency / Повтор после рестарта API
|
||||
E exclusion refers to missing evidence/auth/passwords-and-tokens.md: sessions / Токена нет в хранилище
|
||||
E exclusion refers to missing evidence/auth/passwords-and-tokens.md: users / Хэш в БД
|
||||
SKIPPED [1] student-tests/test_attachment_processing.py:475: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
|
||||
two series of 18 requests: {'772710ec8dda': 36}
|
||||
ready in 0.64 s
|
||||
coverage: 371 scenarios in 16 specs, 349 tested (164 by make failure_checks), 22 excluded
|
||||
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
|
||||
SKIPPED [1] student-tests/test_attachment_processing.py:511: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
SKIPPED [1] student-tests/test_attachments.py:748: one API process (EXPECT_REPLICAS=1): replica checks need the stand with the load balancer
|
||||
SKIPPED [1] student-tests/test_idempotency.py:372: 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
|
||||
===== 1 failed, 212 passed, 6 skipped, 140 deselected in 129.89s (0:02:09) =====
|
||||
===== 1 failed, 217 passed, 6 skipped, 141 deselected in 135.58s (0:02:15) =====
|
||||
[test_isolated] cleanup
|
||||
[test_isolated] remove objects /buckets/messenger/test_messenger/ and queue test_messenger.attachment.process.v1
|
||||
[test_isolated] results: {'test': 0, 'student_test': 2}
|
||||
|
||||
Reference in New Issue
Block a user