python student-tests/run_failover.py
hook: scripts/stop-one.cmd; api replicas: ['901d91ace549', 'c0f257b4b378']

=== run 1: containers before (HAProxy: api1 UP, api2 UP)
SERVICE   CONTAINER     STATE                STARTED AT (UTC)
api       901d91ace549  running (healthy)    2026-10-22T14:01:25.740
api       c0f257b4b378  running (healthy)    2026-10-22T14:05:06.764
lb        57f9ebc04460  running (healthy)    2026-10-22T14:01:26.528
migrate   51b3180c16d9  exited               2026-10-22T14:01:22.887
postgres  b4b2a3cf061f  running (healthy)    2026-10-22T13:58:38.541
s3        cf488bd53603  running (healthy)    2026-10-22T13:58:38.538
s3-init   f596754a9e8b  exited               2026-10-22T14:01:22.889
valkey    d4851200ad55  running (healthy)    2026-10-22T13:58:38.539
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.891}

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       901d91ace549  exited               2026-10-22T14:01:25.740
api       c0f257b4b378  running (healthy)    2026-10-22T14:05:06.764
lb        57f9ebc04460  running (healthy)    2026-10-22T14:01:26.528
migrate   51b3180c16d9  exited               2026-10-22T14:01:22.887
postgres  b4b2a3cf061f  running (healthy)    2026-10-22T13:58:38.541
s3        cf488bd53603  running (healthy)    2026-10-22T13:58:38.538
s3-init   f596754a9e8b  exited               2026-10-22T14:01:22.889
valkey    d4851200ad55  running (healthy)    2026-10-22T13:58:38.539
the hook stopped 901d91ace549 (X-Instance-Id of that replica = container ID); other api containers, postgres, valkey, s3 and lb kept running
restored: docker start 901d91ace549 -> 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       901d91ace549  running (healthy)    2026-10-22T14:05:30.621
api       c0f257b4b378  running (healthy)    2026-10-22T14:05:06.764
lb        57f9ebc04460  running (healthy)    2026-10-22T14:01:26.528
migrate   51b3180c16d9  exited               2026-10-22T14:01:22.887
postgres  b4b2a3cf061f  running (healthy)    2026-10-22T13:58:38.541
s3        cf488bd53603  running (healthy)    2026-10-22T13:58:38.538
s3-init   f596754a9e8b  exited               2026-10-22T14:01:22.889
valkey    d4851200ad55  running (healthy)    2026-10-22T13:58:38.539
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.469}

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       901d91ace549  running (healthy)    2026-10-22T14:05:30.621
api       c0f257b4b378  exited               2026-10-22T14:05:06.764
lb        57f9ebc04460  running (healthy)    2026-10-22T14:01:26.528
migrate   51b3180c16d9  exited               2026-10-22T14:01:22.887
postgres  b4b2a3cf061f  running (healthy)    2026-10-22T13:58:38.541
s3        cf488bd53603  running (healthy)    2026-10-22T13:58:38.538
s3-init   f596754a9e8b  exited               2026-10-22T14:01:22.889
valkey    d4851200ad55  running (healthy)    2026-10-22T13:58:38.539
the hook stopped c0f257b4b378 (X-Instance-Id of that replica = container ID); other api containers, postgres, valkey, s3 and lb kept running
restored: docker start c0f257b4b378 -> healthy and back in HAProxy (api1 UP, api2 UP)

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