lab3: evidence, отчёт и документация (C5)

- REPORT.md: запуск из чистого clone, архитектура и решения, таблица доказательств
  по каждому заявленному критерию, методика экспериментов, гипотезы H1–H5,
  результаты серии A (1/2/4 реплики), диагностики горячего чата и пути чтения,
  серии роста ресурсов, A/B улучшения и таблица отказов, ограничения и следующие шаги.
- evidence/: индекс (README.md), level3 (smoke, persistence, failover по каждой
  реплике с переходами статусов LB) и level4 (spread, идемпотентность, failover
  каждой реплики под нагрузкой, rolling update, отказы зависимостей, лимиты и
  порты) плюс raw-данные трека 1: сводки k6, сжатые потоки сэмплера, манифесты
  условий измерения, таблицы и графики.
- app/README.md и infra/README.md: LB и реплики, семантика Idempotency-Key,
  /internal/lb-check, переменные окружения, дрейн по SIGTERM, харнесс.
- .env.example приведён к реальной конфигурации (убраны SESSION_STORE/CACHE_URL_FILE,
  добавлены DATABASE_URL/REDIS_URL/лимиты стенда/BUILD_ID и т.д.);
  .lab3-quiesce.json добавлен в .gitignore.
This commit is contained in:
2026-10-15 23:14:20 +03:00
parent 5a5a8fe5cb
commit 2950b77967
152 changed files with 11205 additions and 29 deletions
@@ -0,0 +1,23 @@
=== failover одной реплики: остановлена mtusi-lab3-api-1 (прогон 4)
commit: 410e1ea3ad1b12b1bc650484c3531e6bf76479be
captured_at 2026-10-15T18:29:41Z
--- api-реплики до теста:
4579bce31e8d mtusi-lab3-api-1
77b49a240814 mtusi-lab3-api-2
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 0, "first_recovery_seconds": 3.436}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
--- api-реплики после теста:
77b49a240814 mtusi-lab3-api-2
--- цель TARGET_INSTANCE_ID = 4579bce31e8d; hostname контейнера = X-Instance-Id, остановка docker stop --time 10 (SIGTERM -> дрейн 3s)
--- HAProxy: переходы статусов backend-слотов во время теста:
2026-10-15T18:28:56Z api1 addr=172.30.0.5:8080 status=UP check=L7OK
2026-10-15T18:28:56Z api2 addr=172.30.0.4:8080 status=UP check=L7OK
2026-10-15T18:28:57Z api1 addr=172.30.0.5:8080 status=DOWN check=L7STS
2026-10-15T18:29:00Z api1 addr=172.30.0.5:8080 status=DOWN check=* L7STS
2026-10-15T18:29:01Z api1 addr= status=MAINT (resolution) check=
@@ -0,0 +1,23 @@
=== failover одной реплики: остановлена mtusi-lab3-api-2 (прогон 1)
commit: 410e1ea3ad1b12b1bc650484c3531e6bf76479be
captured_at 2026-10-15T18:26:23Z
--- api-реплики до теста:
4579bce31e8d mtusi-lab3-api-1
77b49a240814 mtusi-lab3-api-2
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 130, "failed_attempts": 0, "first_recovery_seconds": 3.294}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
--- api-реплики после теста:
4579bce31e8d mtusi-lab3-api-1
--- цель TARGET_INSTANCE_ID = 77b49a240814 (hostname контейнера совпадает с X-Instance-Id, docker stop --time 10)
--- HAProxy: переходы статусов во время теста:
2026-10-15T18:25:37Z api1 addr=172.30.0.5:8080 status=UP check=L7OK
2026-10-15T18:25:37Z api2 addr=172.30.0.4:8080 status=UP check=L7OK
2026-10-15T18:25:39Z api2 addr=172.30.0.4:8080 status=UP 1/2 check=L7STS
2026-10-15T18:25:39Z api2 addr=172.30.0.4:8080 status=DOWN check=L7STS
2026-10-15T18:25:42Z api2 addr= status=MAINT (resolution) check=
+45
View File
@@ -0,0 +1,45 @@
=== make test-persistence ACTION_SCRIPT=scripts/restart.sh
captured_at 2026-10-15T18:25:20Z
commit: 410e1ea3ad1b12b1bc650484c3531e6bf76479be
--- контейнеры до (docker compose ps):
api mtusi-lab3-api-1 Up 4 minutes (healthy)
api mtusi-lab3-api-2 Up 4 minutes (healthy)
haproxy mtusi-lab3-haproxy-1 Up 12 minutes
postgres mtusi-lab3-postgres-1 Up 11 minutes (healthy)
redis mtusi-lab3-redis-1 Up 11 minutes (healthy)
--- StartedAt до:
/mtusi-lab3-postgres-1 2026-10-15T18:14:09.923334614Z
/mtusi-lab3-redis-1 2026-10-15T18:13:39.438121274Z
/mtusi-lab3-api-1 2026-10-15T18:20:38.061888309Z
/mtusi-lab3-api-2 2026-10-15T18:20:38.216722318Z
/mtusi-lab3-haproxy-1 2026-10-15T18:12:52.388753254Z
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost: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.
--- контейнеры после:
api mtusi-lab3-api-1 Up 5 seconds (healthy)
api mtusi-lab3-api-2 Up 5 seconds (healthy)
haproxy mtusi-lab3-haproxy-1 Up 8 seconds
postgres mtusi-lab3-postgres-1 Up 8 seconds (healthy)
redis mtusi-lab3-redis-1 Up 8 seconds (healthy)
--- StartedAt после (все значения должны быть новее):
/mtusi-lab3-postgres-1 2026-10-15T18:25:22.182545013Z
/mtusi-lab3-redis-1 2026-10-15T18:25:22.245653432Z
/mtusi-lab3-api-1 2026-10-15T18:25:25.078945419Z
/mtusi-lab3-api-2 2026-10-15T18:25:25.059004849Z
/mtusi-lab3-haproxy-1 2026-10-15T18:25:22.115352599Z
--- содержимое restart.sh:
#!/usr/bin/env bash
# Restart hook for `make test-persistence ACTION_SCRIPT=scripts/restart.sh`.
# Semantic and evidence notes: tests/README.md ("Проверка сохранности") and REPORT.md.
set -euo pipefail
compose=(docker compose --env-file .env)
"${compose[@]}" restart postgres redis api haproxy
"${compose[@]}" up -d --no-recreate --no-deps --wait postgres redis api haproxy
+11
View File
@@ -0,0 +1,11 @@
=== make test (публичный smoke lab3)
captured_at 2026-10-15T18:25:16Z
commit: 410e1ea3ad1b12b1bc650484c3531e6bf76479be
api mtusi-lab3-api-1 Up 4 minutes (healthy)
api mtusi-lab3-api-2 Up 4 minutes (healthy)
haproxy mtusi-lab3-haproxy-1 Up 12 minutes
postgres mtusi-lab3-postgres-1 Up 11 minutes (healthy)
redis mtusi-lab3-redis-1 Up 11 minutes (healthy)
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.