forked from mtusi2026/mtusi2026lab3
- X-Instance-Id в каждом ответе; обязательный Idempotency-Key, таблица idempotency_keys (миграция 0002, одна транзакция, конкурентные повторы через уникальный индекс) - graceful shutdown: SIGTERM -> ready=503 -> drain 3 с -> закрытие порта - compose: lb (HAProxy) + api x2 без портов + разовый migrate + postgres, лимиты CPU/RAM - хуки stop-one/restart/restore-replicas, scripts/experiments.py (failover, idempotency, rolling) - свои тесты: 44 (13 новых); evidence: smoke, pytest, persistence, failover, эксперименты
34 lines
1.7 KiB
Plaintext
34 lines
1.7 KiB
Plaintext
# 2026-10-29T10:51:49 public failover test (final config), repeated until every replica was stopped once; restore between runs
|
|
replicas: 3de2fdb570eb, 945116f913cc
|
|
## run 1 — containers BEFORE
|
|
945116f913cc mtusi-lab3-api-5 Up 36 seconds (healthy)
|
|
3de2fdb570eb mtusi-lab3-api-6 Up About a minute (healthy)
|
|
$ python tests/resilience.py --mode failover --action-script scripts/stop-one.cmd
|
|
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
|
{"observed_instances_before": 2, "successful_writes": 91, "failed_attempts": 0, "first_recovery_seconds": 5.459}
|
|
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
|
exit=0
|
|
## run 1 — containers AFTER
|
|
945116f913cc mtusi-lab3-api-5 Up 57 seconds (healthy)
|
|
3de2fdb570eb mtusi-lab3-api-6 Exited (0) 10 seconds ago
|
|
stopped by hook: 3de2fdb570eb
|
|
$ scripts\restore-replicas.cmd
|
|
exit=0
|
|
|
|
## run 2 — containers BEFORE
|
|
945116f913cc mtusi-lab3-api-5 Up About a minute (healthy)
|
|
3de2fdb570eb mtusi-lab3-api-6 Up 11 seconds (healthy)
|
|
$ python tests/resilience.py --mode failover --action-script scripts/stop-one.cmd
|
|
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
|
{"observed_instances_before": 2, "successful_writes": 90, "failed_attempts": 0, "first_recovery_seconds": 4.847}
|
|
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
|
exit=0
|
|
## run 2 — containers AFTER
|
|
945116f913cc mtusi-lab3-api-5 Exited (0) 11 seconds ago
|
|
3de2fdb570eb mtusi-lab3-api-6 Up 32 seconds (healthy)
|
|
stopped by hook: 945116f913cc
|
|
$ scripts\restore-replicas.cmd
|
|
exit=0
|
|
|
|
replicas stopped at least once: 945116f913cc, 3de2fdb570eb of 2
|