# failover: public failover test for every replica, file downloaded via the other one (make test-failover)
# date: 2026-10-22 14:23:28, commit: c942c61 + uncommitted changes
# command: python.exe student-tests/run_failover.py
# exit code: 0, 43.2 s

hook: scripts\stop-one.cmd; api replicas: ['343119df2488', 'd590adc21943']
=== run 1: api containers before
SERVICE   CONTAINER ID   STATUS
api       343119df2488   Up 27 seconds (healthy)
api       d590adc21943   Up 27 seconds (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.

{"observed_instances_before": 2, "successful_writes": 123, "failed_attempts": 0, "first_recovery_seconds": 4.422}

PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
api containers after
SERVICE   CONTAINER ID   STATUS
api       343119df2488   Exited (0) 11 seconds ago
api       d590adc21943   Up 43 seconds (healthy)
the hook stopped 343119df2488 (X-Instance-Id of that replica = container ID); other api containers kept running, postgres/redis/lb were not touched
restored: docker start 343119df2488 -> healthy and back in HAProxy
=== run 2: api containers before
SERVICE   CONTAINER ID   STATUS
api       343119df2488   Up 4 seconds (healthy)
api       d590adc21943   Up 48 seconds (healthy)
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.531}

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