# failover: public failover test for every replica (make test-failover)
# date: 2026-10-14 20:25:10, commit: 0ab3a34 + uncommitted changes
# command: python.exe student-tests/run_failover.py
# exit code: 0, 37.8 s

hook: scripts\stop-one.cmd; api replicas: ['58542a53644c', '9737b915ff2f']
=== run 1: api containers before
SERVICE   CONTAINER ID   STATUS
api       58542a53644c   Up About a minute (healthy)
api       9737b915ff2f   Up About a minute (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 4.203}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
api containers after
SERVICE   CONTAINER ID   STATUS
api       58542a53644c   Exited (0) 11 seconds ago
api       9737b915ff2f   Up About a minute (healthy)
the hook stopped 58542a53644c (X-Instance-Id of that replica = container ID); other api containers kept running, postgres/redis/lb were not touched
restored: docker start 58542a53644c -> healthy and back in HAProxy
=== run 2: api containers before
SERVICE   CONTAINER ID   STATUS
api       58542a53644c   Up 1 second (healthy)
api       9737b915ff2f   Up About a minute (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 132, "failed_attempts": 0, "first_recovery_seconds": 4.281}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
api containers after
SERVICE   CONTAINER ID   STATUS
api       58542a53644c   Up 18 seconds (healthy)
api       9737b915ff2f   Exited (0) 11 seconds ago
the hook stopped 9737b915ff2f (X-Instance-Id of that replica = container ID); other api containers kept running, postgres/redis/lb were not touched
restored: docker start 9737b915ff2f -> healthy and back in HAProxy
PASS: public failover test passed 2 times; every api replica was stopped once and restored
