PS> docker compose run --rm -T tools python student-tests/grade3.py failover
 Container mtusi-lab3-grade3-tools-run-e2ebc343dc86 Creating
 Container mtusi-lab3-grade3-tools-run-e2ebc343dc86 Created
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 118, "failed_attempts": 0, "first_recovery_seconds": 1.893}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
PASS: api2 read confirmed history after api1 stopped in 0.892s
{"target": "api1", "before": {"api1": "9b898d6720dca8eb1cfb84fde08090f64b808a495578c0185c77bd63892fdf1f running 2026-11-20T11:44:11.521174934Z", "api2": "ab7c05600399d2c7dc9c5beb0dc661eb222032d32a9758f9cee945b4ae196a02 running 2026-11-20T11:44:11.248047203Z"}, "after": {"api1": "9b898d6720dca8eb1cfb84fde08090f64b808a495578c0185c77bd63892fdf1f exited 2026-11-20T11:44:11.521174934Z", "api2": "ab7c05600399d2c7dc9c5beb0dc661eb222032d32a9758f9cee945b4ae196a02 running 2026-11-20T11:44:11.248047203Z"}}
PASS: api2 replayed e580ba9a-ae15-4763-89a5-4985eaec6d0c while api1 was stopped, history count 1
9b898d6720dca8eb1cfb84fde08090f64b808a495578c0185c77bd63892fdf1f
PASS: api1 rejoined the LB with the same Bearer; migrator was not restarted
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 116, "failed_attempts": 0, "first_recovery_seconds": 1.889}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
PASS: api1 read confirmed history after api2 stopped in 1.002s
{"target": "api2", "before": {"api1": "9b898d6720dca8eb1cfb84fde08090f64b808a495578c0185c77bd63892fdf1f running 2026-11-20T11:44:35.925512672Z", "api2": "ab7c05600399d2c7dc9c5beb0dc661eb222032d32a9758f9cee945b4ae196a02 running 2026-11-20T11:44:11.248047203Z"}, "after": {"api1": "9b898d6720dca8eb1cfb84fde08090f64b808a495578c0185c77bd63892fdf1f running 2026-11-20T11:44:35.925512672Z", "api2": "ab7c05600399d2c7dc9c5beb0dc661eb222032d32a9758f9cee945b4ae196a02 exited 2026-11-20T11:44:11.248047203Z"}}
PASS: api1 replayed 8ee32cdc-1ad9-46f6-8f0c-fa5c3854353c while api2 was stopped, history count 1
ab7c05600399d2c7dc9c5beb0dc661eb222032d32a9758f9cee945b4ae196a02
PASS: api2 rejoined the LB with the same Bearer; migrator was not restarted
exit=0
