docs: re-capture s3-storage evidence after verify fixes
- evidence/s3 and evidence/tests re-captured from f57635a: first write
after healthy, deleted bucket, netstat-based port check, readiness
with s3 paused, prefix cleanup check
- PLAN: HEAD on a deleted bucket is an accepted limitation
- KNOWN_ISSUES: bootstrap after a manual bucket delete
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
# `make failure_checks` со своим S3
|
||||
|
||||
- Дата: 2026-10-20, 17:21:58–17:23:29 UTC.
|
||||
- Commit: `2e997f9`.
|
||||
- Дата: 2026-10-20, 18:35:12–18:37:20 UTC.
|
||||
- Commit: `f57635a` (рабочее дерево — только `PLAN.md` вне кода).
|
||||
- Стенд отказов: проект `mtusi-lab4-failures` (Postgres, Valkey, S3 с
|
||||
bootstrap, без портов хранилищ), два API на `127.0.0.1`. Рабочий стенд
|
||||
`mtusi-lab4` в это время запущен. Docker Desktop 29.8.2, Apple M3 Pro.
|
||||
- Новая проверка change `s3-storage` —
|
||||
`test_readiness_without_object_storage`: спек `health`, «Хранилище
|
||||
объектов недоступно».
|
||||
`test_readiness_without_object_storage[stop|pause]`: спек `health`,
|
||||
«Хранилище объектов недоступно». Вариант `pause` добавлен по находке
|
||||
verify S3. Проба hook после `unpause` и `start` — та же команда, что
|
||||
healthcheck `s3`, с регистрацией тома (находка W1).
|
||||
|
||||
## Итог: код 2, пять красных — ожидаемо до change `attachments`
|
||||
|
||||
@@ -23,7 +25,7 @@
|
||||
отправку сообщения. Чинит change `attachments` (ответ пользователя
|
||||
2026-10-20, `PLAN.md`, `s3-storage`, «Вопросы», п. 2), там этот файл
|
||||
переснимается зелёным. S3 и стенд отказов здесь ни при чём: остальные
|
||||
13 проверок, включая новую, прошли.
|
||||
14 проверок, включая оба варианта новой, прошли.
|
||||
|
||||
## Вывод (строки оркестратора и pytest)
|
||||
|
||||
@@ -38,28 +40,29 @@ s3-bootstrap-1 | s3-bootstrap: bucket messenger created
|
||||
s3-bootstrap-1 | s3-bootstrap: user api created
|
||||
s3-bootstrap-1 | s3-bootstrap: checks passed (api key put/get/delete; api key list and bucket create, anonymous get and list denied)
|
||||
[failure_checks] start api containers
|
||||
[failure_checks] ready: api=http://127.0.0.1:59374 tight=http://127.0.0.1:59382
|
||||
[failure_checks] ready: api=http://127.0.0.1:54756 tight=http://127.0.0.1:54761
|
||||
[failure_checks] pytest -m fault
|
||||
student-tests/test_failures.py::test_expired_token PASSED [ 5%]
|
||||
student-tests/test_failures.py::test_use_does_not_extend_session PASSED [ 11%]
|
||||
student-tests/test_failures.py::test_token_while_database_stopped PASSED [ 16%]
|
||||
student-tests/test_failures.py::test_members_failure_rolls_back_chat PASSED [ 22%]
|
||||
student-tests/test_failures.py::test_database_stopped_and_back FAILED [ 27%]
|
||||
student-tests/test_failures.py::test_pool_exhausted PASSED [ 33%]
|
||||
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 38%]
|
||||
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 44%]
|
||||
student-tests/test_failures.py::test_readiness_without_database PASSED [ 50%]
|
||||
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 55%]
|
||||
student-tests/test_failures.py::test_readiness_without_object_storage PASSED [ 61%]
|
||||
student-tests/test_failures.py::test_flush_cache PASSED [ 66%]
|
||||
student-tests/test_failures.py::test_valkey_stopped FAILED [ 72%]
|
||||
student-tests/test_failures.py::test_valkey_paused PASSED [ 77%]
|
||||
student-tests/test_failures.py::test_valkey_back PASSED [ 83%]
|
||||
student-tests/test_failures.py::test_message_failure_keeps_key_free FAILED [ 88%]
|
||||
student-tests/test_failures.py::test_use_does_not_extend_session PASSED [ 10%]
|
||||
student-tests/test_failures.py::test_token_while_database_stopped PASSED [ 15%]
|
||||
student-tests/test_failures.py::test_members_failure_rolls_back_chat PASSED [ 21%]
|
||||
student-tests/test_failures.py::test_database_stopped_and_back FAILED [ 26%]
|
||||
student-tests/test_failures.py::test_pool_exhausted PASSED [ 31%]
|
||||
student-tests/test_failures.py::test_connection_limit_reached PASSED [ 36%]
|
||||
student-tests/test_failures.py::test_pool_keeps_connections PASSED [ 42%]
|
||||
student-tests/test_failures.py::test_readiness_without_database PASSED [ 47%]
|
||||
student-tests/test_failures.py::test_readiness_without_cache PASSED [ 52%]
|
||||
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 57%]
|
||||
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [ 63%]
|
||||
student-tests/test_failures.py::test_flush_cache PASSED [ 68%]
|
||||
student-tests/test_failures.py::test_valkey_stopped FAILED [ 73%]
|
||||
student-tests/test_failures.py::test_valkey_paused PASSED [ 78%]
|
||||
student-tests/test_failures.py::test_valkey_back PASSED [ 84%]
|
||||
student-tests/test_failures.py::test_message_failure_keeps_key_free FAILED [ 89%]
|
||||
student-tests/test_failures.py::test_database_outage_keeps_key_free FAILED [ 94%]
|
||||
student-tests/test_failures.py::test_key_free_after_ttl FAILED [100%]
|
||||
=========== 5 failed, 13 passed, 142 deselected in 69.48s (0:01:09) ============
|
||||
[failure_checks] postgres log: 380 lines, crash markers 0; "too many clients" 25, "administrator command" 129
|
||||
=========== 5 failed, 14 passed, 142 deselected in 69.63s (0:01:09) ============
|
||||
[failure_checks] postgres log: 381 lines, crash markers 0; "too many clients" 26, "administrator command" 129
|
||||
[failure_checks] last 50 lines of mtusi-lab4-failures-api
|
||||
[failure_checks] last 50 lines of mtusi-lab4-failures-api-tight
|
||||
[failure_checks] cleanup
|
||||
@@ -69,6 +72,19 @@ exit=2
|
||||
|
||||
Журналы API стенда отказов, которые печатает оркестратор, здесь опущены.
|
||||
|
||||
## Только проверки S3
|
||||
|
||||
```
|
||||
$ make failure_checks FAULT_ARGS='-k object_storage'
|
||||
s3-bootstrap-1 | s3-bootstrap: checks passed (api key put/get/delete; api key list and bucket create, anonymous get and list denied)
|
||||
student-tests/test_failures.py::test_readiness_without_object_storage[stop] PASSED [ 50%]
|
||||
student-tests/test_failures.py::test_readiness_without_object_storage[pause] PASSED [100%]
|
||||
====================== 2 passed, 159 deselected in 7.71s =======================
|
||||
[failure_checks] postgres log: 57 lines, crash markers 0; "too many clients" 0, "administrator command" 0
|
||||
[failure_checks] results: {'fault': 0, 'postgres': 0}
|
||||
exit=0
|
||||
```
|
||||
|
||||
## Уборка и рабочий стенд
|
||||
|
||||
```
|
||||
@@ -82,9 +98,10 @@ left: containers 0, volumes 0
|
||||
|
||||
## Новая проверка
|
||||
|
||||
`test_readiness_without_object_storage`: hook останавливает `s3` стенда
|
||||
отказов (`stop_grace_period: 2s`). `GET /health/ready` и `GET
|
||||
/health/live` отвечают 200 `{"status": "ok"}` быстрее 1 с, после этого
|
||||
`s3` запускается снова. Отдельный прогон `make failure_checks
|
||||
FAULT_ARGS='-k object_storage'` в apply: `1 passed`, код 0, стенд отказов
|
||||
убран, у рабочего стенда прежний `StartedAt`.
|
||||
`test_readiness_without_object_storage[stop|pause]`: hook останавливает
|
||||
(`stop_grace_period: 2s`) или замораживает (`docker pause`) `s3` стенда
|
||||
отказов. `GET /health/ready` и `GET /health/live` отвечают 200
|
||||
`{"status": "ok"}` быстрее 1 с, затем `s3` возвращается (`start` или
|
||||
`unpause` с пробой healthcheck). При `pause` соединение с S3 есть, а
|
||||
ответа нет: проверка, которая всё же ходила бы в S3, ждала бы срока
|
||||
вызова (5 с), а не отказа соединения.
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
# `make test_isolated`: уборка объектов S3 временной базы
|
||||
|
||||
- Дата: 2026-10-20, 17:23:36–17:25:14 UTC.
|
||||
- Commit: `2e997f9`.
|
||||
- Стенд: рабочий `mtusi-lab4` (`make run_docker`). Временная база
|
||||
`test_messenger`, S3 и Valkey стенда общие.
|
||||
- Дата: 2026-10-20, 18:39:04–18:42:42 UTC.
|
||||
- Commit: `f57635a` (рабочее дерево — только `PLAN.md` вне кода).
|
||||
- Стенд: рабочий `mtusi-lab4` (`make run_docker` с этого commit).
|
||||
Временная база `test_messenger`, S3 и Valkey стенда общие. Раздел 3 —
|
||||
временный стенд (ниже).
|
||||
- Спек `student-tests`: «Прогон на временной базе» (уборка префикса
|
||||
`test_<db>/`, «Хвост прошлого прогона», «Сохранить базу для разбора»).
|
||||
Design change `s3-storage`, решение 9.
|
||||
Design change `s3-storage`, решение 9 и «Уточнения apply», п. 11.
|
||||
|
||||
## Итог прогона: код 2, красное — ожидаемо до change `attachments`
|
||||
|
||||
@@ -14,29 +15,33 @@
|
||||
контракта лабы 4 требует поле `attachment_ids`, которого в коде лабы 3
|
||||
нет. Загрузки вложения тоже ещё нет.
|
||||
- `make student_test EXPECT_REPLICAS=1`: `30 failed, 106 passed, 4
|
||||
skipped, 18 deselected, 2 errors`.
|
||||
skipped, 19 deselected, 2 errors`.
|
||||
- 29 упавших и 2 ошибки фикстуры (`test_tampered_cursor`) — с одной
|
||||
причиной: `Message` / `MessagePage schema: 'attachment_ids' is a
|
||||
required property`.
|
||||
- Ещё одна — `test_exclusion_evidence_exists`: файлы исключений сверки
|
||||
покрытия снимаются заново на стенде лабы 4, после `attachments`.
|
||||
- `test_every_scenario_is_covered` прошёл.
|
||||
- `19 deselected` вместо прежних 18: проверка отказов
|
||||
`test_readiness_without_object_storage` стала двумя (`stop`, `pause`),
|
||||
а тесты `fault` здесь не выполняются.
|
||||
|
||||
Список совпадает с уточнённым в шапке `tasks.md` change `s3-storage`.
|
||||
Чинит change `attachments` (ответ пользователя 2026-10-20, `PLAN.md`),
|
||||
там прогон переснимается зелёным.
|
||||
|
||||
## Уборка префикса
|
||||
## 1. Уборка префикса
|
||||
|
||||
Перед прогоном разовым скриптом `prefix_probe.py` (клиент `src/infra/s3`)
|
||||
записаны объекты `test_messenger/probe` (будто хвост прошлого прогона) и
|
||||
`messenger/probe` (рабочая база).
|
||||
Перед прогоном разовым скриптом `prefix_probe.py` (клиент `src/infra/s3`,
|
||||
scratchpad) записаны объекты `test_messenger/probe` (будто хвост прошлого
|
||||
прогона) и `messenger/probe` (рабочая база).
|
||||
|
||||
```
|
||||
$ prefix_probe.py put
|
||||
test_messenger/probe: present
|
||||
messenger/probe: present
|
||||
$ make test_isolated
|
||||
exit=2
|
||||
[test_isolated] database=test_messenger objects=/buckets/messenger/test_messenger/ container=mtusi-lab4-test-api base_url=http://127.0.0.1:18088
|
||||
[test_isolated] remove objects /buckets/messenger/test_messenger/
|
||||
[test_isolated] build image
|
||||
@@ -47,39 +52,81 @@ $ make test_isolated
|
||||
[test_isolated] make test
|
||||
FAIL: response: missing required fields
|
||||
[test_isolated] make student_test
|
||||
= 30 failed, 106 passed, 4 skipped, 18 deselected, 2 errors in 81.02s (0:01:21) =
|
||||
[test_isolated] last 50 lines of mtusi-lab4-test-api
|
||||
= 30 failed, 106 passed, 4 skipped, 19 deselected, 2 errors in 68.42s (0:01:08) =
|
||||
[test_isolated] cleanup
|
||||
[test_isolated] remove objects /buckets/messenger/test_messenger/
|
||||
[test_isolated] results: {'test': 2, 'student_test': 2}
|
||||
exit=2
|
||||
$ prefix_probe.py show
|
||||
test_messenger/probe: absent
|
||||
messenger/probe: present
|
||||
```
|
||||
|
||||
- Префикс `test_messenger/` удалён в начале (хвост) и в уборке. Объект
|
||||
рабочей базы на месте, затем удалён вручную.
|
||||
- Префикс `test_messenger/` удалён в начале (хвост) и в уборке. Обе
|
||||
уборки проверены `fs.ls` (раздел 3): «cleanup failed» в выводе нет.
|
||||
Объект рабочей базы на месте, затем удалён вручную.
|
||||
- База `test_messenger` удалена (`pg_database`: 0 строк), тестового
|
||||
контейнера нет.
|
||||
|
||||
## `KEEP_TEST_DB=1` (apply, 2026-10-20, тот же код)
|
||||
## 2. `KEEP_TEST_DB=1`
|
||||
|
||||
Объект `test_messenger/probe` записан, пока шёл прогон (после строки
|
||||
`ready`):
|
||||
|
||||
```
|
||||
$ make test_isolated KEEP_TEST_DB=1 (probe put after "ready")
|
||||
exit=2
|
||||
[test_isolated] remove objects /buckets/messenger/test_messenger/
|
||||
[test_isolated] ready
|
||||
…
|
||||
= 30 failed, 106 passed, 4 skipped, 19 deselected, 2 errors in 69.75s (0:01:09) =
|
||||
[test_isolated] cleanup
|
||||
[test_isolated] kept database test_messenger and objects /buckets/messenger/test_messenger/
|
||||
[test_isolated] results: {'test': 2, 'student_test': 2}
|
||||
$ prefix_probe.py show
|
||||
test_messenger/probe: present
|
||||
messenger/probe: present
|
||||
```
|
||||
|
||||
Префикс и база остались, команда напечатала оба. Потом их убрали вручную:
|
||||
`DROP DATABASE` и `weed shell fs.rm -r`.
|
||||
Префикс и база остались, команда напечатала оба. Затем их убрали
|
||||
вручную: `DROP DATABASE test_messenger`, `prefix_probe.py delete` и
|
||||
`weed shell` `fs.rm -r /buckets/messenger/test_messenger`. После этого в
|
||||
bucket — только префикс `messenger`.
|
||||
|
||||
Префикс собирается только из имени, прошедшего `^test_[a-z0-9_]+$`, и
|
||||
проверенного имени bucket (`run_isolated.py`, `object_prefix`). Иначе —
|
||||
код 2 до любых действий.
|
||||
|
||||
## 3. Неудачная уборка замечается
|
||||
|
||||
Находка verify S2: `weed shell` выходит с кодом 0 и при ошибке команды,
|
||||
поэтому прежний `remove_objects` не замечал неудачной уборки. С
|
||||
`f57635a` он разбирает строки `rm:` (кроме «no entry is found» —
|
||||
префикса нет) и проверяет пустой `fs.ls` префикса. Иначе —
|
||||
`RuntimeError`: в начале прогона это код 1 до тестов, в уборке —
|
||||
«cleanup failed» и код 1.
|
||||
|
||||
Временный стенд: проект compose `mtusi-lab4-s3fresh`, S3 на tmpfs (без
|
||||
volumes), порт `127.0.0.1:18334`. Bootstrap прошёл, объект `test_x/probe`
|
||||
записан ключом API. `s2_check.py` (scratchpad) вызывает `remove_objects`
|
||||
из `run_isolated.py` против этого проекта (`COMPOSE_PROJECT_NAME`,
|
||||
`COMPOSE_FILE`) в трёх вариантах:
|
||||
- команда `weed shell` для `fs.rm` направлена на недоступный filer;
|
||||
- `fs.rm` подменена на путь, которого нет, и ничего не удаляет;
|
||||
- настоящая уборка.
|
||||
|
||||
После проверки стенд удалён (`down`).
|
||||
|
||||
```
|
||||
$ weed shell: fs.rm -r via unavailable filer, then exit code
|
||||
rm: /buckets/messenger/test_x: LookupEntry1: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:10001: connect: connection refused"
|
||||
weed shell exit=0
|
||||
$ s2_check.py
|
||||
filer unavailable: RuntimeError: objects /buckets/messenger/test_x/ not removed: rm: /buckets/messenger/test_x: LookupEntry1: rpc error: code = Unavailable desc = connection error: desc = "transport: Error while dialing: dial tcp 127.0.0.1:10001: connect: connection refused"
|
||||
nothing removed: RuntimeError: objects /buckets/messenger/test_x/ not removed: 1 entries left
|
||||
real cleanup: removed, fs.ls -> ''
|
||||
```
|
||||
|
||||
- Ошибка `fs.rm` при коде 0 `weed shell` теперь — исключение с первой
|
||||
строкой ошибки.
|
||||
- Объект, который `fs.rm` не удалил, находит `fs.ls`.
|
||||
- Настоящая уборка проходит, префикс пуст.
|
||||
|
||||
Reference in New Issue
Block a user