Implement lab 3 level 4 failover and idempotency
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# Фрагмент для REPORT.md: persistence на текущем стенде
|
||||
|
||||
Команда: `python3 student-tests/lab3/prove_persistence.py --project highload-lab3 --base-url http://127.0.0.1:8080 --output evidence/lab3-persistence-2026-10-29-current`. Она запускает `make test-persistence ACTION_SCRIPT=scripts/restart.sh` и отдельный `student-tests/lab3/run.py --scenario restart` через публичный LB.
|
||||
|
||||
Оба сценария: **PASS**. Публичный тест подтвердил сохранность прежнего Bearer token и сообщения; отдельный повтор POST с исходным Idempotency-Key вернул тот же HTTP 201 и тот же Message, история содержит одну запись.
|
||||
|
||||
| Сценарий | Сервис | Docker ID | StartedAt до (UTC) | StartedAt после (UTC) | Named volumes до/после |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| public-persistence | api | `1ae27ab07357` | 2026-10-29T11:27:27.861065055Z | 2026-10-29T11:29:44.682674507Z | — |
|
||||
| public-persistence | api | `9beb711884eb` | 2026-10-29T11:27:27.82161318Z | 2026-10-29T11:29:44.699364507Z | — |
|
||||
| public-persistence | postgres | `0147d3048618` | 2026-10-29T11:27:27.148151971Z | 2026-10-29T11:29:43.853707132Z | highload-lab3_postgres_data |
|
||||
| public-persistence | redis | `cf2f36cce64a` | 2026-10-29T11:27:26.495196304Z | 2026-10-29T11:29:43.758210798Z | highload-lab3_redis_data |
|
||||
| public-persistence | lb | `f088f4ab3441` | 2026-10-29T11:27:28.670374416Z | 2026-10-29T11:29:45.235568757Z | — |
|
||||
| lab3-idempotency-restart | api | `1ae27ab07357` | 2026-10-29T11:29:44.682674507Z | 2026-10-29T11:29:49.648314301Z | — |
|
||||
| lab3-idempotency-restart | api | `9beb711884eb` | 2026-10-29T11:29:44.699364507Z | 2026-10-29T11:29:49.630126634Z | — |
|
||||
| lab3-idempotency-restart | postgres | `0147d3048618` | 2026-10-29T11:29:43.853707132Z | 2026-10-29T11:29:48.900130467Z | highload-lab3_postgres_data |
|
||||
| lab3-idempotency-restart | redis | `cf2f36cce64a` | 2026-10-29T11:29:43.758210798Z | 2026-10-29T11:29:48.916318134Z | highload-lab3_redis_data |
|
||||
| lab3-idempotency-restart | lb | `f088f4ab3441` | 2026-10-29T11:29:45.235568757Z | 2026-10-29T11:29:50.910677427Z | — |
|
||||
|
||||
Docker ID и именованные volumes для каждой строки совпали до и после, `StartedAt` изменился, контейнеры после перезапуска запущены. Сырые данные: `summary.json`, `lifecycle.jsonl`; HTTP: `public-persistence.stdout.log`, `lab3-run/summary.json`. Содержимое токенов и паролей не сохранялось.
|
||||
|
||||
Одноразовый Compose-проект `lab2-test-d9c74f5f6f35`: `compose-up`, `teacher-persistence`, `lab3-restart-idempotency` и `cleanup` — PASS. В нём проверена прежняя одно-репличная конфигурация собственных тестов; lifecycle-снимки подтверждают реальный рестарт. Scope результата — `persistence-only`, он не означает прохождение полного `stack.py verify`. Сырые данные: `../lab3-isolated-persistence-2026-10-29-current/summary.json` и `lifecycle.jsonl`.
|
||||
@@ -0,0 +1,3 @@
|
||||
PASS idempotency_survives_restart
|
||||
PASS idempotency_setup_and_suite
|
||||
Evidence: /Users/olegromanovich/Library/Mobile Documents/com~apple~CloudDocs/Пары/Высоконагруженные приложения/HighLoad/evidence/lab3-persistence-2026-10-29-current/lab3-run/summary.json
|
||||
@@ -0,0 +1 @@
|
||||
{"base_url": "http://127.0.0.1:8080", "hooks": {"restart": ["/Users/olegromanovich/Library/Mobile Documents/com~apple~CloudDocs/\u041f\u0430\u0440\u044b/\u0412\u044b\u0441\u043e\u043a\u043e\u043d\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f/HighLoad/scripts/restart.sh"]}}
|
||||
@@ -0,0 +1,3 @@
|
||||
{"elapsed_seconds": 2.555, "event": "hook", "exit_code": 0, "name": "restart", "target_instance": null, "time_utc": "2026-10-29T11:29:51Z"}
|
||||
{"detail": "", "elapsed_seconds": 3.458, "event": "case", "name": "idempotency_survives_restart", "status": "PASS", "time_utc": "2026-10-29T11:29:51Z"}
|
||||
{"detail": "", "elapsed_seconds": 4.239, "event": "case", "name": "idempotency_setup_and_suite", "status": "PASS", "time_utc": "2026-10-29T11:29:51Z"}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"idempotency_setup_and_suite": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 4.239,
|
||||
"status": "PASS"
|
||||
},
|
||||
"idempotency_survives_restart": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 3.458,
|
||||
"status": "PASS"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
{"action": "restart", "project": "highload-lab3", "source": "public-persistence", "before": {"api": [{"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e", "started_at": "2026-10-29T11:27:27.861065055Z", "running": true, "volumes": []}, {"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa", "started_at": "2026-10-29T11:27:27.82161318Z", "running": true, "volumes": []}], "postgres": {"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7", "started_at": "2026-10-29T11:27:27.148151971Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151", "started_at": "2026-10-29T11:27:26.495196304Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12", "started_at": "2026-10-29T11:27:28.670374416Z", "running": true, "volumes": []}}, "after": {"api": [{"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e", "started_at": "2026-10-29T11:29:44.682674507Z", "running": true, "volumes": []}, {"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa", "started_at": "2026-10-29T11:29:44.699364507Z", "running": true, "volumes": []}], "postgres": {"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7", "started_at": "2026-10-29T11:29:43.853707132Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151", "started_at": "2026-10-29T11:29:43.758210798Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12", "started_at": "2026-10-29T11:29:45.235568757Z", "running": true, "volumes": []}}}
|
||||
{"action": "restart", "project": "highload-lab3", "source": "lab3-idempotency-restart", "before": {"api": [{"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e", "started_at": "2026-10-29T11:29:44.682674507Z", "running": true, "volumes": []}, {"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa", "started_at": "2026-10-29T11:29:44.699364507Z", "running": true, "volumes": []}], "postgres": {"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7", "started_at": "2026-10-29T11:29:43.853707132Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151", "started_at": "2026-10-29T11:29:43.758210798Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12", "started_at": "2026-10-29T11:29:45.235568757Z", "running": true, "volumes": []}}, "after": {"api": [{"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e", "started_at": "2026-10-29T11:29:49.648314301Z", "running": true, "volumes": []}, {"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa", "started_at": "2026-10-29T11:29:49.630126634Z", "running": true, "volumes": []}], "postgres": {"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7", "started_at": "2026-10-29T11:29:48.900130467Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151", "started_at": "2026-10-29T11:29:48.916318134Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12", "started_at": "2026-10-29T11:29:50.910677427Z", "running": true, "volumes": []}}}
|
||||
@@ -0,0 +1,3 @@
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:8080"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,172 @@
|
||||
{
|
||||
"project": "highload-lab3",
|
||||
"base_url": "http://127.0.0.1:8080",
|
||||
"scope": "public LB and Docker Compose service containers",
|
||||
"results": {
|
||||
"public-persistence": {
|
||||
"exit_code": 0,
|
||||
"seconds": 4.162,
|
||||
"before": {
|
||||
"api": [
|
||||
{
|
||||
"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e",
|
||||
"started_at": "2026-10-29T11:27:27.861065055Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa",
|
||||
"started_at": "2026-10-29T11:27:27.82161318Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7",
|
||||
"started_at": "2026-10-29T11:27:27.148151971Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151",
|
||||
"started_at": "2026-10-29T11:27:26.495196304Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12",
|
||||
"started_at": "2026-10-29T11:27:28.670374416Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"api": [
|
||||
{
|
||||
"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e",
|
||||
"started_at": "2026-10-29T11:29:44.682674507Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa",
|
||||
"started_at": "2026-10-29T11:29:44.699364507Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7",
|
||||
"started_at": "2026-10-29T11:29:43.853707132Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151",
|
||||
"started_at": "2026-10-29T11:29:43.758210798Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12",
|
||||
"started_at": "2026-10-29T11:29:45.235568757Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"docker_transition": "PASS",
|
||||
"status": "PASS"
|
||||
},
|
||||
"lab3-idempotency-restart": {
|
||||
"exit_code": 0,
|
||||
"seconds": 5.3,
|
||||
"before": {
|
||||
"api": [
|
||||
{
|
||||
"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e",
|
||||
"started_at": "2026-10-29T11:29:44.682674507Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa",
|
||||
"started_at": "2026-10-29T11:29:44.699364507Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7",
|
||||
"started_at": "2026-10-29T11:29:43.853707132Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151",
|
||||
"started_at": "2026-10-29T11:29:43.758210798Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12",
|
||||
"started_at": "2026-10-29T11:29:45.235568757Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"api": [
|
||||
{
|
||||
"id": "1ae27ab07357b20d301c6b6a6379805a45ac7cf0baf00ee97672feebaa83f12e",
|
||||
"started_at": "2026-10-29T11:29:49.648314301Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "9beb711884eb865fee43ba66d0159739cd44b60e420f25b5ed5de8e8d734fdaa",
|
||||
"started_at": "2026-10-29T11:29:49.630126634Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "0147d3048618c9b75f8cdbbf4aef13dcaacfa774618204cbc887598f9064feb7",
|
||||
"started_at": "2026-10-29T11:29:48.900130467Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "cf2f36cce64a672e7071559c0f0145b3043ebfc8e8f43256bdc4196cacef8151",
|
||||
"started_at": "2026-10-29T11:29:48.916318134Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "f088f4ab344140b4270469fc1d82bb331c95963a9604390b4251cf944c398e12",
|
||||
"started_at": "2026-10-29T11:29:50.910677427Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"docker_transition": "PASS",
|
||||
"status": "PASS"
|
||||
}
|
||||
},
|
||||
"status": "PASS"
|
||||
}
|
||||
Reference in New Issue
Block a user