python student-tests/run_failover.py
hook: scripts/stop-one.cmd; api replicas: ['4e5560c6d072', '7740e49a1d8c']

=== run 1: containers before (HAProxy: api1 UP, api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       4e5560c6d072  running (healthy)    2026-10-14T20:46:50.376
api       7740e49a1d8c  running (healthy)    2026-10-14T20:46:50.691
lb        91c0051bd4c8  running (healthy)    2026-10-14T20:46:51.195
migrate   523965b912bb  exited               2026-10-14T20:46:48.669
postgres  5c16b9b684f2  running (healthy)    2026-10-14T21:05:32.785
valkey    c74935587700  running (healthy)    2026-10-14T21:05:11.672
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 0, "first_recovery_seconds": 4.437}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
containers after (HAProxy: api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       4e5560c6d072  running (healthy)    2026-10-14T20:46:50.376
api       7740e49a1d8c  exited               2026-10-14T20:46:50.691
lb        91c0051bd4c8  running (healthy)    2026-10-14T20:46:51.195
migrate   523965b912bb  exited               2026-10-14T20:46:48.669
postgres  5c16b9b684f2  running (healthy)    2026-10-14T21:05:32.785
valkey    c74935587700  running (healthy)    2026-10-14T21:05:11.672
the hook stopped 7740e49a1d8c (X-Instance-Id of that replica = container ID); other api containers, postgres, valkey and lb kept running
restored: docker start 7740e49a1d8c -> healthy and back in HAProxy (api1 UP, api2 UP)

=== run 2: containers before (HAProxy: api1 UP, api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       4e5560c6d072  running (healthy)    2026-10-14T20:46:50.376
api       7740e49a1d8c  running (healthy)    2026-10-14T21:07:12.761
lb        91c0051bd4c8  running (healthy)    2026-10-14T20:46:51.195
migrate   523965b912bb  exited               2026-10-14T20:46:48.669
postgres  5c16b9b684f2  running (healthy)    2026-10-14T21:05:32.785
valkey    c74935587700  running (healthy)    2026-10-14T21:05:11.672
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 124, "failed_attempts": 0, "first_recovery_seconds": 4.594}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
containers after (HAProxy: api1 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       4e5560c6d072  exited               2026-10-14T20:46:50.376
api       7740e49a1d8c  running (healthy)    2026-10-14T21:07:12.761
lb        91c0051bd4c8  running (healthy)    2026-10-14T20:46:51.195
migrate   523965b912bb  exited               2026-10-14T20:46:48.669
postgres  5c16b9b684f2  running (healthy)    2026-10-14T21:05:32.785
valkey    c74935587700  running (healthy)    2026-10-14T21:05:11.672
the hook stopped 4e5560c6d072 (X-Instance-Id of that replica = container ID); other api containers, postgres, valkey and lb kept running
restored: docker start 4e5560c6d072 -> healthy and back in HAProxy (api1 UP, api2 UP)

PASS: public failover test passed 2 times; every api replica was stopped once and restored
