﻿# failover runs 2026-11-07T18:03:34.5946145+03:00 (HAProxy, drain 4 s)
# command (= make test-failover ACTION_SCRIPT=scripts/stop-one.cmd): python tests/resilience.py --mode failover --action-script scripts/stop-one.cmd --base-url http://localhost:8080
## run 1 - before (shift requests through LB: 0)
messenger-lab3-api-1 1b755b53e9fa Up 53 seconds (healthy)
messenger-lab3-api-2 e3303afc01b2 Up 53 seconds (healthy)
api1 172.25.0.2 UP
api2 172.25.0.3 UP
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 121, "failed_attempts": 0, "first_recovery_seconds": 6.421}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
exit=0
## run 1 - after
messenger-lab3-api-1 1b755b53e9fa Up About a minute (healthy)
messenger-lab3-api-2 e3303afc01b2 Exited (0) 9 seconds ago
api1 172.25.0.2 UP
## restored (docker compose --env-file .env up -d --wait)
messenger-lab3-api-1 1b755b53e9fa Up About a minute (healthy)
messenger-lab3-api-2 e3303afc01b2 Up 10 seconds (healthy)
api1 172.25.0.2 UP
api2 172.25.0.3 UP
## run 2 - before (shift requests through LB: 1)
messenger-lab3-api-1 1b755b53e9fa Up About a minute (healthy)
messenger-lab3-api-2 e3303afc01b2 Up 11 seconds (healthy)
api1 172.25.0.2 UP
api2 172.25.0.3 UP
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 115, "failed_attempts": 0, "first_recovery_seconds": 6.437}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
exit=0
## run 2 - after
messenger-lab3-api-1 1b755b53e9fa Exited (0) 9 seconds ago
messenger-lab3-api-2 e3303afc01b2 Up 30 seconds (healthy)
api2 172.25.0.3 UP
## restored (docker compose --env-file .env up -d --wait)
messenger-lab3-api-1 1b755b53e9fa Up 9 seconds (healthy)
messenger-lab3-api-2 e3303afc01b2 Up 43 seconds (healthy)
api1 172.25.0.2 UP
api2 172.25.0.3 UP
