Implement lab 3 level 4 failover and idempotency
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# Доказательства persistence для REPORT.md
|
||||
|
||||
Команда: `python3 student-tests/lab3/prove_persistence.py --project highload-lab3 --base-url http://127.0.0.1:8080 --output student-tests/output/lab3-persistence-2026-10-28`.
|
||||
|
||||
Публичный `make test-persistence ACTION_SCRIPT=scripts/restart.sh`: PASS. Тест подтвердил прежний Bearer token и подтверждённое сообщение после рестарта. Отдельный `--scenario restart`: PASS — повтор того же POST с исходным Idempotency-Key вернул тот же HTTP 201 и тот же Message, история содержит одну запись.
|
||||
|
||||
| Запуск | Сервис | Контейнер ID | StartedAt до (UTC) | StartedAt после (UTC) | Named volumes до/после |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| public-persistence | api | `cda01aeb0e11` | 2026-10-28T20:25:19.323021713Z | 2026-10-28T20:51:09.696933597Z | — |
|
||||
| public-persistence | api | `f891e77739f6` | 2026-10-28T20:24:05.022066262Z | 2026-10-28T20:51:09.793794389Z | — |
|
||||
| public-persistence | postgres | `d309ac0e69ad` | 2026-10-28T19:50:11.003496417Z | 2026-10-28T20:51:09.213279888Z | highload-lab3_postgres_data |
|
||||
| public-persistence | redis | `5f6302e202fc` | 2026-10-28T19:50:11.000868834Z | 2026-10-28T20:51:09.10352268Z | highload-lab3_redis_data |
|
||||
| public-persistence | lb | `98bdd0184e12` | 2026-10-28T19:51:37.837163597Z | 2026-10-28T20:51:10.413181208Z | — |
|
||||
| lab3-idempotency-restart | api | `cda01aeb0e11` | 2026-10-28T20:51:09.696933597Z | 2026-10-28T20:51:14.225233876Z | — |
|
||||
| lab3-idempotency-restart | api | `f891e77739f6` | 2026-10-28T20:51:09.793794389Z | 2026-10-28T20:51:14.268512293Z | — |
|
||||
| lab3-idempotency-restart | postgres | `d309ac0e69ad` | 2026-10-28T20:51:09.213279888Z | 2026-10-28T20:51:13.881476668Z | highload-lab3_postgres_data |
|
||||
| lab3-idempotency-restart | redis | `5f6302e202fc` | 2026-10-28T20:51:09.10352268Z | 2026-10-28T20:51:13.901398751Z | highload-lab3_redis_data |
|
||||
| lab3-idempotency-restart | lb | `98bdd0184e12` | 2026-10-28T20:51:10.413181208Z | 2026-10-28T20:51:14.629672335Z | — |
|
||||
|
||||
Для каждой строки Docker ID и список named volumes до/после совпали, StartedAt изменился, контейнер после рестарта запущен. Полные сырые данные: `summary.json`, `lifecycle.jsonl`; HTTP-логи: `public-persistence.stdout.log`, `lab3-run/summary.json`.
|
||||
|
||||
Дополнительный одноразовый Compose-проект `lab2-test-941b0b78f3fe`: `teacher-persistence` PASS, `lab3-restart-idempotency` PASS, `cleanup` PASS. Общий `stack.py verify` — FAIL из-за других auth/Redis/TTL/race-проверок; его нельзя цитировать как общий PASS. Данные: `student-tests/output/lab3-isolated-verify-2026-10-29/summary.json`.
|
||||
|
||||
После разведения публичного LB и прямого loopback-адреса только для старых lab2-тестов выполнен сфокусированный запуск `stack.py verify --persistence-only` в одноразовом проекте `lab2-test-83d22762ed40`: `compose-up`, `teacher-persistence`, `lab3-restart-idempotency`, `cleanup` — все PASS. Scope в `summary.json` явно `persistence-only`; это не общий PASS полного `verify`. Данные: `evidence/lab3-isolated-persistence-2026-10-29/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/student-tests/output/lab3-persistence-2026-10-28/lab3-run/summary.json
|
||||
@@ -0,0 +1,3 @@
|
||||
{"elapsed_seconds": 1.176, "event": "hook", "exit_code": 0, "name": "restart", "target_instance": null, "time_utc": "2026-10-28T20:51:14Z"}
|
||||
{"detail": "", "elapsed_seconds": 1.867, "event": "case", "name": "idempotency_survives_restart", "status": "PASS", "time_utc": "2026-10-28T20:51:14Z"}
|
||||
{"detail": "", "elapsed_seconds": 2.494, "event": "case", "name": "idempotency_setup_and_suite", "status": "PASS", "time_utc": "2026-10-28T20:51:14Z"}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"idempotency_setup_and_suite": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 2.494,
|
||||
"status": "PASS"
|
||||
},
|
||||
"idempotency_survives_restart": {
|
||||
"detail": "",
|
||||
"elapsed_seconds": 1.867,
|
||||
"status": "PASS"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
{"action": "restart", "project": "highload-lab3", "source": "public-persistence", "before": {"api": [{"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c", "started_at": "2026-10-28T20:25:19.323021713Z", "running": true, "volumes": []}, {"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9", "started_at": "2026-10-28T20:24:05.022066262Z", "running": true, "volumes": []}], "postgres": {"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0", "started_at": "2026-10-28T19:50:11.003496417Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0", "started_at": "2026-10-28T19:50:11.000868834Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7", "started_at": "2026-10-28T19:51:37.837163597Z", "running": true, "volumes": []}}, "after": {"api": [{"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c", "started_at": "2026-10-28T20:51:09.696933597Z", "running": true, "volumes": []}, {"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9", "started_at": "2026-10-28T20:51:09.793794389Z", "running": true, "volumes": []}], "postgres": {"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0", "started_at": "2026-10-28T20:51:09.213279888Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0", "started_at": "2026-10-28T20:51:09.10352268Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7", "started_at": "2026-10-28T20:51:10.413181208Z", "running": true, "volumes": []}}}
|
||||
{"action": "restart", "project": "highload-lab3", "source": "lab3-idempotency-restart", "before": {"api": [{"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c", "started_at": "2026-10-28T20:51:09.696933597Z", "running": true, "volumes": []}, {"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9", "started_at": "2026-10-28T20:51:09.793794389Z", "running": true, "volumes": []}], "postgres": {"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0", "started_at": "2026-10-28T20:51:09.213279888Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0", "started_at": "2026-10-28T20:51:09.10352268Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7", "started_at": "2026-10-28T20:51:10.413181208Z", "running": true, "volumes": []}}, "after": {"api": [{"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c", "started_at": "2026-10-28T20:51:14.225233876Z", "running": true, "volumes": []}, {"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9", "started_at": "2026-10-28T20:51:14.268512293Z", "running": true, "volumes": []}], "postgres": {"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0", "started_at": "2026-10-28T20:51:13.881476668Z", "running": true, "volumes": ["highload-lab3_postgres_data"]}, "redis": {"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0", "started_at": "2026-10-28T20:51:13.901398751Z", "running": true, "volumes": ["highload-lab3_redis_data"]}, "lb": {"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7", "started_at": "2026-10-28T20:51:14.629672335Z", "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": 12.51,
|
||||
"before": {
|
||||
"api": [
|
||||
{
|
||||
"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c",
|
||||
"started_at": "2026-10-28T20:25:19.323021713Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9",
|
||||
"started_at": "2026-10-28T20:24:05.022066262Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0",
|
||||
"started_at": "2026-10-28T19:50:11.003496417Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0",
|
||||
"started_at": "2026-10-28T19:50:11.000868834Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7",
|
||||
"started_at": "2026-10-28T19:51:37.837163597Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"api": [
|
||||
{
|
||||
"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c",
|
||||
"started_at": "2026-10-28T20:51:09.696933597Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9",
|
||||
"started_at": "2026-10-28T20:51:09.793794389Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0",
|
||||
"started_at": "2026-10-28T20:51:09.213279888Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0",
|
||||
"started_at": "2026-10-28T20:51:09.10352268Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7",
|
||||
"started_at": "2026-10-28T20:51:10.413181208Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"docker_transition": "PASS",
|
||||
"status": "PASS"
|
||||
},
|
||||
"lab3-idempotency-restart": {
|
||||
"exit_code": 0,
|
||||
"seconds": 3.123,
|
||||
"before": {
|
||||
"api": [
|
||||
{
|
||||
"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c",
|
||||
"started_at": "2026-10-28T20:51:09.696933597Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9",
|
||||
"started_at": "2026-10-28T20:51:09.793794389Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0",
|
||||
"started_at": "2026-10-28T20:51:09.213279888Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0",
|
||||
"started_at": "2026-10-28T20:51:09.10352268Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7",
|
||||
"started_at": "2026-10-28T20:51:10.413181208Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"api": [
|
||||
{
|
||||
"id": "cda01aeb0e11441689ec23b86912f3ec6f6ad24cbaccd301d01d28410d1d697c",
|
||||
"started_at": "2026-10-28T20:51:14.225233876Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
},
|
||||
{
|
||||
"id": "f891e77739f604b2cc5c69d2a3bd02a75a057159b50c277f8cae82215f7b79d9",
|
||||
"started_at": "2026-10-28T20:51:14.268512293Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
],
|
||||
"postgres": {
|
||||
"id": "d309ac0e69ad0f474f9efe758649abc0b2a319973f9fc4400cb0a0a61cbabed0",
|
||||
"started_at": "2026-10-28T20:51:13.881476668Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_postgres_data"
|
||||
]
|
||||
},
|
||||
"redis": {
|
||||
"id": "5f6302e202fcacfb90a2600f7495968248a8793707de5e6e4238ca60e72abfb0",
|
||||
"started_at": "2026-10-28T20:51:13.901398751Z",
|
||||
"running": true,
|
||||
"volumes": [
|
||||
"highload-lab3_redis_data"
|
||||
]
|
||||
},
|
||||
"lb": {
|
||||
"id": "98bdd0184e1296c9bbf64a21046d66f52a29a8f5c8c1bfdb3521adc155b767e7",
|
||||
"started_at": "2026-10-28T20:51:14.629672335Z",
|
||||
"running": true,
|
||||
"volumes": []
|
||||
}
|
||||
},
|
||||
"docker_transition": "PASS",
|
||||
"status": "PASS"
|
||||
}
|
||||
},
|
||||
"status": "PASS"
|
||||
}
|
||||
Reference in New Issue
Block a user