diff --git a/docs/work-items/ORCH-062/13-test-report.md b/docs/work-items/ORCH-062/13-test-report.md new file mode 100644 index 0000000..9707f17 --- /dev/null +++ b/docs/work-items/ORCH-062/13-test-report.md @@ -0,0 +1,86 @@ +--- +result: PASS # PASS | FAIL — машинный вердикт, UPPERCASE +work_item: ORCH-062 +stage: testing +author_agent: tester +status: pass +created_at: 2026-06-09 +model_used: claude-opus-4-8 +type: test-report +work_item_id: ORCH-062 +--- + +# Test Report — ORCH-062 — INFRA: авто-prune docker build cache на mva154 + +## Окружение +- Python: 3.12.13 +- pytest: 8.3.3 +- Worktree: `/repos/_wt/orchestrator/feature_ORCH-062-infra-prune-docker-build-cache/` +- Ветка: `feature/ORCH-062-infra-prune-docker-build-cache` +- Дата: 2026-06-09 +- Команда: `cd && python -m pytest tests/ -v --tb=short` + +## Предусловия +- Review-вердикт ORCH-062 (`12-review.md`): **APPROVED** (P0/P1 отсутствуют). ✅ +- Тесты прогнаны строго из worktree ветки задачи (не из общего `/repos/orchestrator`). ✅ + +## Smoke API (read-only) +| Проверка | Результат | +|----------|-----------| +| `GET /health` | ✅ `{"status":"ok","service":"orchestrator"}` | +| `GET /status` | ✅ отвечает (ORCH-062 = id 75, stage `testing`) | +| `GET /queue` → блок `serial_gate` (ORCH-088) | ✅ присутствует | +| `GET /queue` → блок `auto_labels` (ORCH-089) | ✅ присутствует | +| `GET /queue` → блок `build_cache_prune` (ORCH-062) | ⚠️ отсутствует в проде — **ожидаемо** (см. примечание) | + +> **Примечание (не регресс):** прод-контейнер на 8500 работает на текущем (старом) коде — +> фича ORCH-062 ещё НЕ задеплоена (это стадия `testing`, деплой впереди). Блок +> `build_cache_prune` в `GET /queue` проверяется на коде ветки интеграционным TC-12 +> (`test_tc12_queue_has_build_cache_block` / `test_tc12_queue_disabled_block`) через +> FastAPI test client — оба PASS. Смок-требование о наличии `serial_gate` (и `auto_labels`) +> в полезной нагрузке `/queue` выполнено. Регресса смока нет. + +## Результаты по TC (04-test-plan.yaml ↔ 03-acceptance-criteria.md) + +| TC ID | Тип | Описание | AC | Pytest-кейс(ы) | Результат | +|-------|-----|----------|----|----------------|-----------| +| TC-01 | unit | decide=PRUNE при истёкшем периоде | AC-1 | `test_tc01_decide_prune_when_interval_elapsed` | PASS | +| TC-02 | unit | decide=SKIP внутри периода (анти-частота) | AC-1 | `test_tc02_decide_skip_within_interval` | PASS | +| TC-03 | unit | команда несёт `until=`, только builder, без image/system prune; `-a` только с `until` | AC-2/AC-3 | `test_tc03_command_carries_until_and_is_builder_only`, `test_tc03_all_flag_only_paired_with_until` | PASS | +| TC-04 | unit | never-raise: исключение / ненулевой rc → тик не падает, ошибка залогирована | AC-4 | `test_tc04_subprocess_exception_does_not_raise`, `test_tc04_nonzero_rc_recorded` | PASS | +| TC-05 | unit | never-raise: недоступность docker.sock / пустой ssh-таргет → тик no-op, цикл жив | AC-4 | `test_tc05_socket_unavailable_skips_tick`, `test_tc05_no_ssh_target_is_noop` | PASS | +| TC-06 | unit | never-raise: таймаут команды проглатывается | AC-4 | `test_tc06_timeout_swallowed` | PASS | +| TC-07 | unit | kill-switch: `*_enabled=False` → start() no-op, поток не стартует | AC-5 | `test_tc07_killswitch_does_not_start`, `test_tc07_killswitch_status_block` | PASS | +| TC-08 | unit | config: невалидный interval/until/notify_min_gb → warning + безопасный дефолт, старт не падает | AC-6 | `test_tc08_invalid_interval_falls_back_to_default`, `test_tc08_invalid_until_falls_back_to_24h`, `test_tc08_negative_notify_min_gb_falls_back_to_zero` | PASS | +| TC-09 | unit | status() never-raise + содержит enabled/interval_s/until/last_run_ts/last_reclaimed/last_error | AC-7 | `test_tc09_status_shape`, `test_tc09_status_reflects_last_prune` | PASS | +| TC-10 | unit | изоляция от QG: leaf-модуль (нет импортов stage_engine/stages/qg); STAGE_TRANSITIONS/QG_CHECKS не изменены | AC-8 | `test_tc10_module_is_leaf_no_pipeline_imports`, `test_tc10_stage_transitions_and_qg_unchanged` | PASS | +| TC-11 | integration | lifespan: при включённом флаге демон стартует и корректно останавливается | AC-1 | `test_tc11_lifespan_starts_and_stops` | PASS | +| TC-12 | integration | `GET /queue` несёт read-only блок авто-prune; при выключенном флаге `enabled=false` | AC-5/AC-7 | `test_tc12_queue_has_build_cache_block`, `test_tc12_queue_disabled_block` | PASS | + +Доп. кейсы модуля (вне нумерации TC, усиливают покрытие): `test_parse_reclaimed_variants`, +`test_notify_on_significant_reclaim` — PASS. + +**Покрытие:** все 12 TC из `04-test-plan.yaml` выполнены и сопоставлены с критериями приёмки +AC-1…AC-8. AC-9 (документация + зелёный регресс) подтверждён зелёным `pytest tests/` и +review-осью документации (`12-review.md`). + +## Вывод pytest + +Модуль ORCH-062 (`tests/test_build_cache_pruner.py`): +``` +collected 23 items +... (TC-01 … TC-12, 23 кейса) ... +======================== 23 passed, 1 warning in 0.38s ========================= +``` + +Полный регресс (`pytest tests/ -v --tb=short`): +``` +======================= 1319 passed, 1 warning in 34.74s ======================= +``` +(1 warning — известная Pydantic V2 deprecation в `src/config.py:8`, не связана с задачей.) + +## Итог +PASS — все 1319 тестов зелёные, новый модуль покрыт TC-01…TC-12 (23 кейса, docker замокан — +ни один тест не трогает реальный docker/диск), smoke read-only OK (`serial_gate` и `auto_labels` +присутствуют в `/queue`). Каждый TC из плана сопоставлен с AC. Задача готова к переходу на +`deploy-staging`.