This commit is contained in:
2026-11-07 17:43:15 +03:00
parent 8cd25e448f
commit 124c83e450
7 changed files with 138 additions and 54 deletions
+35 -28
View File
@@ -1,34 +1,41 @@
# failover run 2026-11-05T16:51:38.6795653+03:00
## run 1 — before
messenger-lab3-api-1 5dce519fa2a3 Up 22 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up 22 seconds (healthy)
# failover run 2026-11-07T17:39:07.3980307+03:00
# 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 8b33a91fafee Up 20 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 2 minutes (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 126, "failed_attempts": 0, "first_recovery_seconds": 1.598}
{"observed_instances_before": 2, "successful_writes": 127, "failed_attempts": 0, "first_recovery_seconds": 1.27}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
## run 1 — after
messenger-lab3-api-1 5dce519fa2a3 Exited (0) 13 seconds ago
messenger-lab3-api-2 d0fe578a76ab Up 39 seconds (healthy)
## run 2 — before
messenger-lab3-api-1 5dce519fa2a3 Up 6 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up 48 seconds (healthy)
exit=0
## run 1 - after
messenger-lab3-api-1 8b33a91fafee Exited (0) 14 seconds ago
messenger-lab3-api-2 a87734e887a5 Up 2 minutes (healthy)
## restored (docker compose --env-file .env up -d --wait)
messenger-lab3-api-1 8b33a91fafee Up 6 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 2 minutes (healthy)
## run 2 - before (shift requests through LB: 0)
messenger-lab3-api-1 8b33a91fafee Up 6 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 2 minutes (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 126, "failed_attempts": 0, "first_recovery_seconds": 1.575}
{"observed_instances_before": 2, "successful_writes": 128, "failed_attempts": 0, "first_recovery_seconds": 1.166}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
## run 2 — after
messenger-lab3-api-1 5dce519fa2a3 Exited (0) 13 seconds ago
messenger-lab3-api-2 d0fe578a76ab Up About a minute (healthy)
## restored
messenger-lab3-api-1 5dce519fa2a3 Up 6 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up About a minute (healthy)
## run 3 (target api-2) — before
messenger-lab3-api-1 5dce519fa2a3 Up 17 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up About a minute (healthy)
exit=0
## run 2 - after
messenger-lab3-api-1 8b33a91fafee Exited (0) 14 seconds ago
messenger-lab3-api-2 a87734e887a5 Up 3 minutes (healthy)
## restored (docker compose --env-file .env up -d --wait)
messenger-lab3-api-1 8b33a91fafee Up 6 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 3 minutes (healthy)
## run 3 - before (shift requests through LB: 1)
messenger-lab3-api-1 8b33a91fafee Up 6 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 3 minutes (healthy)
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 126, "failed_attempts": 0, "first_recovery_seconds": 1.707}
{"observed_instances_before": 2, "successful_writes": 127, "failed_attempts": 0, "first_recovery_seconds": 1.213}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
## run 3 — after
messenger-lab3-api-1 5dce519fa2a3 Up 34 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Exited (0) 13 seconds ago
## restored
messenger-lab3-api-1 5dce519fa2a3 Up 44 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up 6 seconds (healthy)
exit=0
## run 3 - after
messenger-lab3-api-1 8b33a91fafee Up 22 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Exited (0) 14 seconds ago
## restored (docker compose --env-file .env up -d --wait)
messenger-lab3-api-1 8b33a91fafee Up 31 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 6 seconds (healthy)
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
# X-Instance-Id run 2026-11-07T17:41:06.5911429+03:00
## python scripts/show_instances.py --base-url http://localhost:8080
login + chat via LB http://localhost:8080: one session token for user 2ec10789-7814-4751-9e23-7b85215c262e (token not printed)
1. GET /api/v1/users/me -> 200 X-Instance-Id=8b33a91fafee
2. POST /api/v1/chats/{id}/messages -> 201 X-Instance-Id=a87734e887a5
3. GET /api/v1/users/me -> 200 X-Instance-Id=8b33a91fafee
4. POST /api/v1/chats/{id}/messages -> 201 X-Instance-Id=a87734e887a5
5. GET /api/v1/users/me -> 200 X-Instance-Id=8b33a91fafee
6. POST /api/v1/chats/{id}/messages -> 201 X-Instance-Id=a87734e887a5
PASS: same session served by 2 replicas without re-login {'8b33a91fafee': 3, 'a87734e887a5': 3}
exit=0
## docker compose ps api (X-Instance-Id = container hostname = short container ID)
messenger-lab3-api-1 8b33a91fafee Up 31 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 31 seconds (healthy)
/messenger-lab3-api-1 hostname=8b33a91fafee
/messenger-lab3-api-2 hostname=a87734e887a5
+16 -10
View File
@@ -1,12 +1,18 @@
# before
messenger-lab3-api-1 5dce519fa2a3 Up 52 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up 14 seconds (healthy)
messenger-lab3-lb-1 ece2ac882f2d Up About a minute (healthy)
messenger-lab3-postgres-1 0ed6d04de263 Up 7 minutes (healthy)
# persistence run 2026-11-07T17:40:29.1339292+03:00
# command (= make test-persistence ACTION_SCRIPT=scripts/restart.cmd): python tests/resilience.py --mode persistence --action-script scripts/restart.cmd --base-url http://localhost:8080
## before
messenger-lab3-api-1 8b33a91fafee Up 38 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 14 seconds (healthy)
messenger-lab3-lb-1 4ba96e32076f Up 3 minutes (healthy)
messenger-lab3-migrate-1 18f3889ef9a7 Exited (0) 14 seconds ago
messenger-lab3-postgres-1 4c60c6522907 Up 3 minutes (healthy)
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
# after
messenger-lab3-api-1 5dce519fa2a3 Up 12 seconds (healthy)
messenger-lab3-api-2 d0fe578a76ab Up 12 seconds (healthy)
messenger-lab3-lb-1 ece2ac882f2d Up 5 seconds (healthy)
messenger-lab3-postgres-1 0ed6d04de263 Up 17 seconds (healthy)
exit=0
## after (same container IDs, fresh uptime = restarted; volume pgdata kept)
messenger-lab3-api-1 8b33a91fafee Up 11 seconds (healthy)
messenger-lab3-api-2 a87734e887a5 Up 11 seconds (healthy)
messenger-lab3-lb-1 4ba96e32076f Up 5 seconds (healthy)
messenger-lab3-migrate-1 18f3889ef9a7 Exited (0) 12 seconds ago
messenger-lab3-postgres-1 4c60c6522907 Up 15 seconds (healthy)
volume messenger-lab3_pgdata
Binary file not shown.