chore: refresh evidence

This commit is contained in:
2026-11-01 18:05:27 +03:00
parent 252ebd017a
commit 5e4342ce8b
10 changed files with 366 additions and 369 deletions
+13 -13
View File
@@ -1,22 +1,22 @@
# Стенд: сервисы, порты, лимиты, секреты, миграции
# date: 2026-11-01T14:23:40Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:53:14Z
# commit: 252ebd0
$ docker compose ps -a --format table {{.Service}}\t{{.Name}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}
SERVICE NAME IMAGE STATUS PORTS
api messenger-lab3-api-10 mtusi-messenger-lab3-api:dev Up 6 minutes (healthy) 8080/tcp
api messenger-lab3-api-9 mtusi-messenger-lab3-api:dev Up 6 minutes (healthy) 8080/tcp
lb messenger-lab3-lb-1 haproxy:3.0.6-alpine Up 11 minutes 127.0.0.1:8080->8080/tcp
migrate messenger-lab3-migrate-1 mtusi-messenger-lab3-migrate:dev Exited (0) 7 minutes ago
postgres messenger-lab3-postgres-1 postgres:17.2-alpine Up 7 minutes (healthy) 5432/tcp
redis messenger-lab3-redis-1 redis:7.4.1-alpine Up 8 minutes (healthy) 6379/tcp
secrets-init messenger-lab3-secrets-init-1 alpine:3.20.3 Exited (0) 7 minutes ago
tools messenger-lab3-tools-run-d623204458ed mtusi-messenger-lab3-tools:dev Up Less than a second
SERVICE NAME IMAGE STATUS PORTS
api messenger-lab3-api-11 sha256:be7b642a4d66d1cd16c6e249edd4c8d3ce687b18ede4343ace709bdfd1ffd1bb Up 24 minutes (healthy) 8080/tcp
api messenger-lab3-api-12 sha256:be7b642a4d66d1cd16c6e249edd4c8d3ce687b18ede4343ace709bdfd1ffd1bb Up 24 minutes (healthy) 8080/tcp
lb messenger-lab3-lb-1 haproxy:3.0.6-alpine Up 28 minutes 127.0.0.1:8080->8080/tcp
migrate messenger-lab3-migrate-1 sha256:fd6f6ebce3f423be91d91b792682f0810ee2b6c332003270e1106ac056b6e947 Exited (0) 25 minutes ago
postgres messenger-lab3-postgres-1 postgres:17.2-alpine Up 25 minutes (healthy) 5432/tcp
redis messenger-lab3-redis-1 redis:7.4.1-alpine Up 25 minutes (healthy) 6379/tcp
secrets-init messenger-lab3-secrets-init-1 alpine:3.20.3 Exited (0) 25 minutes ago
tools messenger-lab3-tools-run-d672896c194d mtusi-messenger-lab3-tools:dev Up 2 seconds
## CPU/RAM-лимиты (NanoCpus: 1e9 = 1 CPU; Memory в байтах)
$ sh -c docker inspect -f '{{.Name}} cpus={{.HostConfig.NanoCpus}} memory={{.HostConfig.Memory}}' $(docker compose ps -q)
/messenger-lab3-api-10 cpus=500000000 memory=268435456
/messenger-lab3-api-9 cpus=500000000 memory=268435456
/messenger-lab3-api-11 cpus=500000000 memory=268435456
/messenger-lab3-api-12 cpus=500000000 memory=268435456
/messenger-lab3-lb-1 cpus=250000000 memory=67108864
/messenger-lab3-postgres-1 cpus=1000000000 memory=536870912
/messenger-lab3-redis-1 cpus=250000000 memory=134217728
+78 -79
View File
@@ -1,138 +1,137 @@
{
"scenario": "sequential failover of each api replica",
"resources_under_load": [
"messenger-lab3-api-10 cpu=45.52% mem=115.8MiB / 256MiB",
"messenger-lab3-api-9 cpu=47.28% mem=96.32MiB / 256MiB",
"messenger-lab3-lb-1 cpu=13.68% mem=16.25MiB / 64MiB",
"messenger-lab3-postgres-1 cpu=24.15% mem=77.63MiB / 512MiB",
"messenger-lab3-redis-1 cpu=2.08% mem=9.832MiB / 128MiB"
"messenger-lab3-api-11 cpu=41.10% mem=97.37MiB / 256MiB",
"messenger-lab3-api-12 cpu=48.76% mem=113.1MiB / 256MiB",
"messenger-lab3-lb-1 cpu=13.94% mem=14.84MiB / 64MiB",
"messenger-lab3-postgres-1 cpu=25.65% mem=78.69MiB / 512MiB",
"messenger-lab3-redis-1 cpu=2.24% mem=9.797MiB / 128MiB"
],
"replicas": [
{
"container": "/messenger-lab3-api-10 running image=f80c910ed3d1",
"container": "/messenger-lab3-api-11 running image=be7b642a4d66",
"action": "docker kill (SIGKILL)",
"before": {
"seconds": 5.0,
"successful_writes": 777,
"successful_writes": 746,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 155.4,
"successful_rps": 149.2,
"latency_ms_successful": {
"p50": 10.6,
"p95": 83.1,
"p99": 158.6
"p50": 11.4,
"p95": 80.5,
"p99": 170.9
},
"max_write_gap_seconds": 0.096,
"max_write_gap_seconds": 0.15,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
},
"stop_command_seconds": 0.478,
"stop_command_seconds": 0.522,
"target_last_success_after_stop_seconds": null,
"outage_window": {
"seconds": 10.478,
"successful_writes": 847,
"seconds": 10.522,
"successful_writes": 732,
"failed_attempts": 3,
"error_ratio": 0.0035,
"successful_rps": 80.8,
"error_ratio": 0.0041,
"successful_rps": 69.6,
"latency_ms_successful": {
"p50": 11.7,
"p95": 88.5,
"p99": 1012.5
"p50": 12.7,
"p95": 100.2,
"p99": 1013.9
},
"max_write_gap_seconds": 0.989,
"max_write_gap_seconds": 0.985,
"instances": [
"75ad096eed0a"
"229dcf033bdc"
]
},
"restore_until_healthy_seconds": 5.506,
"restore_until_serving_seconds": 3.616,
"restore_until_healthy_seconds": 5.97,
"restore_until_serving_seconds": 2.451,
"after_restore": {
"seconds": 5.036,
"successful_writes": 771,
"seconds": 5.024,
"successful_writes": 749,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 153.1,
"successful_rps": 149.1,
"latency_ms_successful": {
"p50": 11.2,
"p95": 80.5,
"p99": 152.1
"p50": 11.1,
"p95": 82.7,
"p99": 140.0
},
"max_write_gap_seconds": 0.147,
"max_write_gap_seconds": 0.091,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
}
},
{
"container": "/messenger-lab3-api-9 running image=f80c910ed3d1",
"container": "/messenger-lab3-api-12 running image=be7b642a4d66",
"action": "docker kill (SIGKILL)",
"before": {
"seconds": 5.0,
"successful_writes": 769,
"successful_writes": 744,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 153.8,
"successful_rps": 148.8,
"latency_ms_successful": {
"p50": 11.2,
"p95": 80.5,
"p99": 152.1
"p50": 11.1,
"p95": 82.7,
"p99": 140.0
},
"max_write_gap_seconds": 0.147,
"max_write_gap_seconds": 0.091,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
},
"stop_command_seconds": 0.503,
"target_last_success_after_stop_seconds": 0.001,
"stop_command_seconds": 0.515,
"target_last_success_after_stop_seconds": null,
"outage_window": {
"seconds": 10.503,
"successful_writes": 706,
"failed_attempts": 2,
"error_ratio": 0.0028,
"successful_rps": 67.2,
"latency_ms_successful": {
"p50": 13.6,
"p95": 98.1,
"p99": 1012.2
},
"max_write_gap_seconds": 0.994,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
]
},
"restore_until_healthy_seconds": 5.898,
"restore_until_serving_seconds": 3.356,
"after_restore": {
"seconds": 5.021,
"successful_writes": 827,
"seconds": 10.515,
"successful_writes": 966,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 164.7,
"successful_rps": 91.9,
"latency_ms_successful": {
"p50": 11.2,
"p95": 73.8,
"p99": 87.4
"p50": 11.6,
"p95": 93.7,
"p99": 184.9
},
"max_write_gap_seconds": 0.092,
"max_write_gap_seconds": 0.992,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"e0c31d893858"
]
},
"restore_until_healthy_seconds": 5.676,
"restore_until_serving_seconds": 3.757,
"after_restore": {
"seconds": 5.024,
"successful_writes": 765,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 152.3,
"latency_ms_successful": {
"p50": 11.8,
"p95": 78.2,
"p99": 92.4
},
"max_write_gap_seconds": 0.152,
"instances": [
"229dcf033bdc",
"e0c31d893858"
]
}
}
],
"dataset": {
"messages_in_db_before": 81019,
"messages_in_db_after": 86799
"messages_in_db_before": 100524,
"messages_in_db_after": 106273
},
"history": {
"confirmed": 5780,
"stored": 5780,
"confirmed": 5749,
"stored": 5749,
"lost_confirmed": 0,
"duplicates": 0
},
@@ -143,5 +142,5 @@
"client_timeout_seconds": 2,
"retry": "same Idempotency-Key until success"
},
"date": "2026-11-01T14:26:57Z"
"date": "2026-11-01T14:56:32Z"
}
+72 -72
View File
@@ -1,139 +1,139 @@
{
"scenario": "sequential failover of each api replica",
"resources_under_load": [
"messenger-lab3-api-10 cpu=50.96% mem=95.24MiB / 256MiB",
"messenger-lab3-api-9 cpu=43.28% mem=130.2MiB / 256MiB",
"messenger-lab3-lb-1 cpu=12.66% mem=13.96MiB / 64MiB",
"messenger-lab3-postgres-1 cpu=24.59% mem=60.97MiB / 512MiB",
"messenger-lab3-redis-1 cpu=2.19% mem=9.832MiB / 128MiB"
"messenger-lab3-api-11 cpu=49.93% mem=130.7MiB / 256MiB",
"messenger-lab3-api-12 cpu=49.39% mem=92.76MiB / 256MiB",
"messenger-lab3-lb-1 cpu=14.25% mem=12.9MiB / 64MiB",
"messenger-lab3-postgres-1 cpu=26.61% mem=70.14MiB / 512MiB",
"messenger-lab3-redis-1 cpu=2.03% mem=9.797MiB / 128MiB"
],
"replicas": [
{
"container": "/messenger-lab3-api-10 running image=f80c910ed3d1",
"container": "/messenger-lab3-api-11 running image=be7b642a4d66",
"action": "docker stop (SIGTERM, graceful)",
"before": {
"seconds": 5.0,
"successful_writes": 784,
"successful_writes": 751,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 156.8,
"successful_rps": 150.2,
"latency_ms_successful": {
"p50": 10.6,
"p95": 78.0,
"p99": 170.9
"p50": 11.4,
"p95": 80.2,
"p99": 163.6
},
"max_write_gap_seconds": 0.088,
"max_write_gap_seconds": 0.085,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
},
"stop_command_seconds": 3.464,
"target_last_success_after_stop_seconds": 1.353,
"stop_command_seconds": 3.515,
"target_last_success_after_stop_seconds": 1.954,
"outage_window": {
"seconds": 13.464,
"successful_writes": 1746,
"seconds": 13.515,
"successful_writes": 1585,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 129.7,
"successful_rps": 117.3,
"latency_ms_successful": {
"p50": 11.1,
"p95": 85.7,
"p99": 172.3
"p50": 12.0,
"p95": 89.6,
"p99": 106.6
},
"max_write_gap_seconds": 0.457,
"max_write_gap_seconds": 0.183,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
},
"restore_until_healthy_seconds": 5.621,
"restore_until_serving_seconds": 3.995,
"restore_until_healthy_seconds": 5.743,
"restore_until_serving_seconds": 3.546,
"after_restore": {
"seconds": 5.026,
"successful_writes": 898,
"seconds": 5.031,
"successful_writes": 709,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 178.7,
"successful_rps": 140.9,
"latency_ms_successful": {
"p50": 9.8,
"p95": 73.4,
"p99": 88.6
"p50": 12.7,
"p95": 81.5,
"p99": 96.2
},
"max_write_gap_seconds": 0.088,
"max_write_gap_seconds": 0.074,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
}
},
{
"container": "/messenger-lab3-api-9 running image=f80c910ed3d1",
"container": "/messenger-lab3-api-12 running image=be7b642a4d66",
"action": "docker stop (SIGTERM, graceful)",
"before": {
"seconds": 5.0,
"successful_writes": 898,
"successful_writes": 702,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 179.6,
"successful_rps": 140.4,
"latency_ms_successful": {
"p50": 9.8,
"p95": 73.4,
"p99": 88.6
"p50": 12.7,
"p95": 81.5,
"p99": 96.2
},
"max_write_gap_seconds": 0.088,
"max_write_gap_seconds": 0.074,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
},
"stop_command_seconds": 3.471,
"target_last_success_after_stop_seconds": 1.969,
"stop_command_seconds": 3.513,
"target_last_success_after_stop_seconds": 1.676,
"outage_window": {
"seconds": 13.471,
"successful_writes": 1791,
"seconds": 13.513,
"successful_writes": 1348,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 132.9,
"successful_rps": 99.8,
"latency_ms_successful": {
"p50": 11.0,
"p95": 87.3,
"p99": 102.5
"p50": 15.2,
"p95": 95.8,
"p99": 105.3
},
"max_write_gap_seconds": 0.103,
"max_write_gap_seconds": 0.18,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
},
"restore_until_healthy_seconds": 5.753,
"restore_until_serving_seconds": 3.591,
"restore_until_healthy_seconds": 5.745,
"restore_until_serving_seconds": 3.471,
"after_restore": {
"seconds": 5.032,
"successful_writes": 854,
"seconds": 5.022,
"successful_writes": 742,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 169.7,
"successful_rps": 147.7,
"latency_ms_successful": {
"p50": 10.3,
"p95": 76.0,
"p99": 92.6
"p50": 11.9,
"p95": 77.6,
"p99": 151.5
},
"max_write_gap_seconds": 0.078,
"max_write_gap_seconds": 0.141,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
]
}
}
],
"dataset": {
"messages_in_db_before": 72994,
"messages_in_db_after": 81019
"messages_in_db_before": 93579,
"messages_in_db_after": 100524
},
"history": {
"confirmed": 8025,
"stored": 8025,
"confirmed": 6945,
"stored": 6945,
"lost_confirmed": 0,
"duplicates": 0
},
@@ -144,5 +144,5 @@
"client_timeout_seconds": 2,
"retry": "same Idempotency-Key until success"
},
"date": "2026-11-01T14:26:05Z"
"date": "2026-11-01T14:55:41Z"
}
+13 -15
View File
@@ -1,42 +1,40 @@
# make test-failover: stop-one.sh останавливает реплику, обслужившую тест; затем вторую
# date: 2026-11-01T14:24:26Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:54:02Z
# commit: 252ebd0
## Прогон 1
### до
/messenger-lab3-api-10 id=2701b0d53e0f running exit=0 finished=2026-11-01T14:24:22.65057843Z
/messenger-lab3-api-9 id=75ad096eed0a running exit=0 finished=2026-11-01T14:24:22.658060985Z
/messenger-lab3-api-11 id=e0c31d893858 running exit=0 finished=2026-11-01T14:53:57.668890771Z
/messenger-lab3-api-12 id=229dcf033bdc running exit=0 finished=2026-11-01T14:53:57.66803913Z
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 126, "failed_attempts": 0, "first_recovery_seconds": 3.475}
{"observed_instances_before": 2, "successful_writes": 132, "failed_attempts": 0, "first_recovery_seconds": 3.509}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
### после: остановленная реплика Exited (0) — штатное завершение по SIGTERM
/messenger-lab3-api-10 id=2701b0d53e0f running exit=0 finished=2026-11-01T14:24:22.65057843Z
/messenger-lab3-api-9 id=75ad096eed0a exited exit=0 finished=2026-11-01T14:24:30.362206587Z
/messenger-lab3-api-11 id=e0c31d893858 exited exit=0 finished=2026-11-01T14:54:05.746763923Z
/messenger-lab3-api-12 id=229dcf033bdc running exit=0 finished=2026-11-01T14:53:57.66803913Z
### журнал HAProxy
Server api/api2 is UP, reason: Layer7 check passed, code: 200, check duration: 2ms. 1 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
Server api/api1 is UP, reason: Layer7 check passed, code: 200, check duration: 1ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 1ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 2ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Server api/api2 was DOWN and now enters maintenance (No IP for server ).
## Прогон 2
### до
/messenger-lab3-api-10 id=2701b0d53e0f running exit=0 finished=2026-11-01T14:24:22.65057843Z
/messenger-lab3-api-9 id=75ad096eed0a running exit=0 finished=2026-11-01T14:24:30.362206587Z
/messenger-lab3-api-11 id=e0c31d893858 running exit=0 finished=2026-11-01T14:54:05.746763923Z
/messenger-lab3-api-12 id=229dcf033bdc running exit=0 finished=2026-11-01T14:53:57.66803913Z
$ make test-failover ACTION_SCRIPT=scripts/stop-one.sh
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 3.43}
{"observed_instances_before": 2, "successful_writes": 131, "failed_attempts": 0, "first_recovery_seconds": 3.668}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
### после: остановленная реплика Exited (0) — штатное завершение по SIGTERM
/messenger-lab3-api-10 id=2701b0d53e0f exited exit=0 finished=2026-11-01T14:24:49.840732823Z
/messenger-lab3-api-9 id=75ad096eed0a running exit=0 finished=2026-11-01T14:24:30.362206587Z
/messenger-lab3-api-11 id=e0c31d893858 running exit=0 finished=2026-11-01T14:54:05.746763923Z
/messenger-lab3-api-12 id=229dcf033bdc exited exit=0 finished=2026-11-01T14:54:25.301405146Z
### журнал HAProxy
Server api/api1 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 1ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
+39 -39
View File
@@ -1,6 +1,6 @@
# Отказы зависимостей, ошибки LB, expiry
# date: 2026-11-01T14:27:40Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:57:16Z
# commit: 252ebd0
## 1. Redis остановлен: вход и Bearer через PostgreSQL; logout — 503 без отзыва (токен остаётся действующим)
$ docker compose stop redis
@@ -9,9 +9,9 @@ $ docker compose stop redis
$ python3 scripts/probe.py logout
register -> 201
login -> 201 expires_at: 2026-11-01T15:27:41.083Z
login -> 201 expires_at: 2026-11-01T15:57:17.123Z
GET /api/v1/users/me -> 200
DELETE /api/v1/auth/sessions/current -> 503 {"error": {"code": "unavailable", "message": "session cache unavailable", "request_id": "7aff0b0d-d263-4bad-ae24-534ed11e5885"}}
DELETE /api/v1/auth/sessions/current -> 503 {"error": {"code": "unavailable", "message": "session cache unavailable", "request_id": "98fedb58-4eb5-4e13-a7cb-e6469a78d258"}}
GET /api/v1/users/me -> 200
$ docker compose start redis
@@ -25,7 +25,7 @@ $ docker compose start redis
## 2. Redis снова доступен: logout отзывает токен на всех репликах
$ python3 scripts/probe.py logout
register -> 201
login -> 201 expires_at: 2026-11-01T15:27:46.084Z
login -> 201 expires_at: 2026-11-01T15:57:21.659Z
GET /api/v1/users/me -> 200
DELETE /api/v1/auth/sessions/current -> 204
GET /api/v1/users/me -> 401
@@ -39,10 +39,10 @@ $ python3 scripts/probe.py status GET /health/live
GET /health/live (anonymous) -> 200 {"status": "ok"}
$ python3 scripts/probe.py status GET /api/v1/chats Bearer unknown-token
GET /api/v1/chats (Bearer unknown-token) -> 503 {"error": {"code": "unavailable", "message": "database unavailable", "request_id": "084e5aa0-f8c4-44c2-91a6-5672ab0fe7f9"}}
GET /api/v1/chats (Bearer unknown-token) -> 503 {"error": {"code": "unavailable", "message": "database unavailable", "request_id": "0ff1f01f-8cd5-40f7-b590-02e64814442f"}}
$ python3 scripts/probe.py status GET /api/v1/users/me
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "f041cada-528c-4d13-bf1e-fefc33ec422e"}}
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "3bbc22fc-5459-4c57-af1f-d63e72844729"}}
$ docker compose start postgres
Container messenger-lab3-secrets-init-1 Starting
@@ -57,13 +57,13 @@ ready
## 4. Все реплики API остановлены: LB отвечает 503 в формате ошибки контракта
$ docker compose stop api
Container messenger-lab3-api-11 Stopping
Container messenger-lab3-api-12 Stopping
Container messenger-lab3-api-12 Stopped
Container messenger-lab3-api-11 Stopped
Container messenger-lab3-api-13 Stopping
Container messenger-lab3-api-14 Stopping
Container messenger-lab3-api-14 Stopped
Container messenger-lab3-api-13 Stopped
$ python3 scripts/probe.py status GET /api/v1/users/me
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "4e1d1184-174b-47c6-9406-6d5e3e7457de"}}
GET /api/v1/users/me (anonymous) -> 503 {"error": {"code": "unavailable", "message": "no API replica available", "request_id": "1f889229-367b-4fa7-8ca1-2c1cda2dce86"}}
$ docker compose start api
Container messenger-lab3-secrets-init-1 Starting
@@ -78,47 +78,47 @@ $ docker compose start api
Container messenger-lab3-migrate-1 Started
Container messenger-lab3-migrate-1 Waiting
Container messenger-lab3-migrate-1 Exited
Container messenger-lab3-api-12 Starting
Container messenger-lab3-api-12 Started
Container messenger-lab3-api-11 Starting
Container messenger-lab3-api-11 Started
Container messenger-lab3-api-14 Starting
Container messenger-lab3-api-14 Started
Container messenger-lab3-api-13 Starting
Container messenger-lab3-api-13 Started
$ python3 scripts/probe.py ready
ready
## 5. Живая, но неготовая реплика: PostgreSQL отклоняет подключения только от одной API (pg_hba reject)
target=b446d5242566 ip=172.25.0.6
$ docker exec b446d5242566 node -e let n=0;const g=p=>require('http').get('http://127.0.0.1:8080'+p,r=>{console.log(p,r.statusCode);r.resume();if(++n===2)process.exit(0)});g('/health/live');g('/health/ready')
target=dfa1f6b6a59a ip=172.25.0.6
$ docker exec dfa1f6b6a59a node -e let n=0;const g=p=>require('http').get('http://127.0.0.1:8080'+p,r=>{console.log(p,r.statusCode);r.resume();if(++n===2)process.exit(0)});g('/health/live');g('/health/ready')
/health/live 200
/health/ready 503
$ python3 scripts/probe.py instances 10
register -> 201
login -> 201 expires_at: 2026-11-01T15:28:12.845Z
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
login -> 201 expires_at: 2026-11-01T15:57:47.146Z
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
Server api/api2 is UP, reason: Layer7 check passed, code: 200, check duration: 2ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 4ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Server api/api1 is UP, reason: Layer7 check passed, code: 200, check duration: 2ms. 2 active and 0 backup servers online. 0 sessions requeued, 0 total in queue.
Server api/api2 is DOWN, reason: Layer7 wrong status, code: 503, info: "Service Unavailable", check duration: 6ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
### доступ возвращён: реплика снова готова и получает запросы
$ python3 scripts/probe.py instances 6
register -> 201
login -> 201 expires_at: 2026-11-01T15:28:17.742Z
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: b446d5242566
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: b446d5242566
GET /api/v1/users/me -> 200 X-Instance-Id: 18dde5d7e3c7
GET /api/v1/users/me -> 200 X-Instance-Id: b446d5242566
login -> 201 expires_at: 2026-11-01T15:57:52.149Z
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: dfa1f6b6a59a
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: dfa1f6b6a59a
GET /api/v1/users/me -> 200 X-Instance-Id: 358dc1d93af4
GET /api/v1/users/me -> 200 X-Instance-Id: dfa1f6b6a59a
## 6. Expiry: реплики пересозданы с SESSION_TTL_SECONDS=2
$ sh -c docker exec $(docker compose ps -q api | head -1) printenv SESSION_TTL_SECONDS
@@ -126,7 +126,7 @@ $ sh -c docker exec $(docker compose ps -q api | head -1) printenv SESSION_TTL_S
$ python3 scripts/probe.py expiry 2
register -> 201
login -> 201 expires_at: 2026-11-01T14:28:30.603Z
login -> 201 expires_at: 2026-11-01T14:58:04.884Z
GET /api/v1/users/me (fresh) -> 200
GET /api/v1/users/me (after 3s) -> 401
+3 -3
View File
@@ -4,9 +4,9 @@
"all_201": true,
"distinct_message_ids": 1,
"instances": [
"2701b0d53e0f",
"75ad096eed0a"
"229dcf033bdc",
"e0c31d893858"
],
"messages_in_history": 1,
"date": "2026-11-01T14:25:07Z"
"date": "2026-11-01T14:54:43Z"
}
+12 -12
View File
@@ -1,13 +1,13 @@
# make test-persistence: restart.sh перезапускает postgres, redis, api, lb с сохранением volumes
# date: 2026-11-01T14:24:18Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:53:52Z
# commit: 252ebd0
## до
/messenger-lab3-api-10 running started=2026-11-01T14:17:40.379508837Z
/messenger-lab3-api-9 running started=2026-11-01T14:17:40.671088423Z
/messenger-lab3-lb-1 running started=2026-11-01T14:12:03.995670618Z
/messenger-lab3-postgres-1 running started=2026-11-01T14:15:47.035908462Z
/messenger-lab3-redis-1 running started=2026-11-01T14:15:35.848126753Z
/messenger-lab3-api-11 running started=2026-11-01T14:28:36.182340349Z
/messenger-lab3-api-12 running started=2026-11-01T14:28:35.862975268Z
/messenger-lab3-lb-1 running started=2026-11-01T14:24:20.477359115Z
/messenger-lab3-postgres-1 running started=2026-11-01T14:27:53.458295909Z
/messenger-lab3-redis-1 running started=2026-11-01T14:27:42.722637458Z
$ make test-persistence ACTION_SCRIPT=scripts/restart.sh
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://lb:8080"
@@ -15,8 +15,8 @@ Executing explicit persistence hook; hook output suppressed to avoid leaking sec
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
## после
/messenger-lab3-api-10 running started=2026-11-01T14:24:23.200745127Z
/messenger-lab3-api-9 running started=2026-11-01T14:24:23.330709545Z
/messenger-lab3-lb-1 running started=2026-11-01T14:24:20.477359115Z
/messenger-lab3-postgres-1 running started=2026-11-01T14:24:20.361554543Z
/messenger-lab3-redis-1 running started=2026-11-01T14:24:20.157181787Z
/messenger-lab3-api-11 running started=2026-11-01T14:53:58.288108033Z
/messenger-lab3-api-12 running started=2026-11-01T14:53:58.128282449Z
/messenger-lab3-lb-1 running started=2026-11-01T14:53:54.339107937Z
/messenger-lab3-postgres-1 running started=2026-11-01T14:53:53.926693488Z
/messenger-lab3-redis-1 running started=2026-11-01T14:53:54.188226051Z
+31 -31
View File
@@ -1,58 +1,58 @@
{
"scenario": "rolling replacement: migrate once, then add new replica, wait healthy, stop old one",
"resources_under_load": [
"messenger-lab3-api-10 cpu=49.91% mem=96.44MiB / 256MiB",
"messenger-lab3-api-9 cpu=44.95% mem=113.9MiB / 256MiB",
"messenger-lab3-lb-1 cpu=12.30% mem=17.51MiB / 64MiB",
"messenger-lab3-postgres-1 cpu=23.73% mem=81.37MiB / 512MiB",
"messenger-lab3-redis-1 cpu=5.40% mem=9.848MiB / 128MiB"
"messenger-lab3-api-11 cpu=46.51% mem=96.45MiB / 256MiB",
"messenger-lab3-api-12 cpu=47.86% mem=113.1MiB / 256MiB",
"messenger-lab3-lb-1 cpu=14.55% mem=16.07MiB / 64MiB",
"messenger-lab3-postgres-1 cpu=26.26% mem=84.64MiB / 512MiB",
"messenger-lab3-redis-1 cpu=2.31% mem=9.805MiB / 128MiB"
],
"before": [
"/messenger-lab3-api-10 running image=f80c910ed3d1",
"/messenger-lab3-api-9 running image=f80c910ed3d1"
],
"after": [
"/messenger-lab3-api-11 running image=be7b642a4d66",
"/messenger-lab3-api-12 running image=be7b642a4d66"
],
"after": [
"/messenger-lab3-api-13 running image=e01eb7165388",
"/messenger-lab3-api-14 running image=e01eb7165388"
],
"steps": [
{
"replaced": "2701b0d53e0f",
"new_replica_ready_seconds": 6.531,
"step_seconds": 10.169
"replaced": "e0c31d893858",
"new_replica_ready_seconds": 6.586,
"step_seconds": 10.193
},
{
"replaced": "75ad096eed0a",
"new_replica_ready_seconds": 6.667,
"step_seconds": 10.21
"replaced": "229dcf033bdc",
"new_replica_ready_seconds": 6.773,
"step_seconds": 10.365
}
],
"during_update": {
"seconds": 30.809,
"successful_writes": 5340,
"seconds": 31.012,
"successful_writes": 4823,
"failed_attempts": 0,
"error_ratio": 0.0,
"successful_rps": 173.3,
"successful_rps": 155.5,
"latency_ms_successful": {
"p50": 11.2,
"p95": 73.5,
"p99": 95.2
"p50": 12.3,
"p95": 78.8,
"p99": 105.4
},
"max_write_gap_seconds": 0.17,
"max_write_gap_seconds": 0.16,
"instances": [
"18dde5d7e3c7",
"2701b0d53e0f",
"75ad096eed0a",
"b446d5242566"
"229dcf033bdc",
"358dc1d93af4",
"dfa1f6b6a59a",
"e0c31d893858"
]
},
"dataset": {
"messages_in_db_before": 86799,
"messages_in_db_after": 93308
"messages_in_db_before": 106273,
"messages_in_db_after": 112337
},
"history": {
"confirmed": 6509,
"stored": 6509,
"confirmed": 6064,
"stored": 6064,
"lost_confirmed": 0,
"duplicates": 0
},
@@ -63,5 +63,5 @@
"client_timeout_seconds": 2,
"retry": "same Idempotency-Key until success"
},
"date": "2026-11-01T14:27:40Z"
"date": "2026-11-01T14:57:16Z"
}
+11 -11
View File
@@ -1,6 +1,6 @@
# Публичные проверки через LB; разные реплики обслуживают одну сессию
# date: 2026-11-01T14:24:16Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:53:50Z
# commit: 252ebd0
$ make check
python3 scripts/check_contract.py
@@ -11,16 +11,16 @@ python3 tests/smoke.py --base-url "http://lb:8080"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
$ sh -c docker compose ps -q api | cut -c1-12
2701b0d53e0f
75ad096eed0a
e0c31d893858
229dcf033bdc
$ python3 scripts/probe.py instances 6
register -> 201
login -> 201 expires_at: 2026-11-01T15:24:18.673Z
GET /api/v1/users/me -> 200 X-Instance-Id: 75ad096eed0a
GET /api/v1/users/me -> 200 X-Instance-Id: 2701b0d53e0f
GET /api/v1/users/me -> 200 X-Instance-Id: 75ad096eed0a
GET /api/v1/users/me -> 200 X-Instance-Id: 2701b0d53e0f
GET /api/v1/users/me -> 200 X-Instance-Id: 75ad096eed0a
GET /api/v1/users/me -> 200 X-Instance-Id: 2701b0d53e0f
login -> 201 expires_at: 2026-11-01T15:53:52.273Z
GET /api/v1/users/me -> 200 X-Instance-Id: e0c31d893858
GET /api/v1/users/me -> 200 X-Instance-Id: 229dcf033bdc
GET /api/v1/users/me -> 200 X-Instance-Id: e0c31d893858
GET /api/v1/users/me -> 200 X-Instance-Id: 229dcf033bdc
GET /api/v1/users/me -> 200 X-Instance-Id: e0c31d893858
GET /api/v1/users/me -> 200 X-Instance-Id: 229dcf033bdc
+94 -94
View File
@@ -1,6 +1,6 @@
# Собственные e2e-тесты (PostgreSQL + Redis из compose.test.yaml)
# date: 2026-11-01T14:23:50Z
# commit: 210ff67 (dirty)
# date: 2026-11-01T14:53:23Z
# commit: 252ebd0
$ docker compose -f compose.test.yaml run --rm tests npx jest --config ./test/jest-e2e.json --verbose
Network messenger-lab3-test_default Creating
@@ -9,10 +9,10 @@ $ docker compose -f compose.test.yaml run --rm tests npx jest --config ./test/je
Container messenger-lab3-test-postgres-1 Creating
Container messenger-lab3-test-redis-1 Created
Container messenger-lab3-test-postgres-1 Created
Container messenger-lab3-test-postgres-1 Starting
Container messenger-lab3-test-redis-1 Starting
Container messenger-lab3-test-redis-1 Started
Container messenger-lab3-test-postgres-1 Starting
Container messenger-lab3-test-postgres-1 Started
Container messenger-lab3-test-redis-1 Started
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "messenger_test", schema "public" at "postgres:5432"
@@ -33,124 +33,124 @@ migrations/
└─ migration.sql
All migrations have been successfully applied.
PASS test/docs.e2e-spec.ts (8.076 s)
PASS test/docs.e2e-spec.ts (8.308 s)
Swagger UI и примеры (e2e)
✓ отдаёт Swagger UI и документ контракта со всеми путями (79 ms)
✓ каждый пример запроса и ответа проходит JSON Schema контракта (458 ms)
✓ каждый пример запроса и ответа проходит JSON Schema контракта (452 ms)
PASS test/concurrency.e2e-spec.ts (9.302 s)
PASS test/concurrency.e2e-spec.ts (9.326 s)
Безопасность при конкурентном доступе (e2e)
✓ принимает 100 конкурентных сообщений от 10 клиентов и сохраняет ровно 100 уникальных (1567 ms)
✓ регистрирует ровно одного пользователя при гонке 10 запросов за один и тот же username (248 ms)
✓ принимает 100 конкурентных сообщений от 10 клиентов и сохраняет ровно 100 уникальных (1479 ms)
✓ регистрирует ровно одного пользователя при гонке 10 запросов за один и тот же username (200 ms)
PASS test/auth.e2e-spec.ts (9.345 s)
PASS test/auth.e2e-spec.ts (9.593 s)
Аутентификация и сессии (e2e)
регистрация
✓ требует password (68 ms)
✓ отклоняет password короче 12 code points (29 ms)
✓ хранит пароль как Argon2id-хеш, а не открытым текстом (154 ms)
✓ требует password (89 ms)
✓ отклоняет password короче 12 code points (22 ms)
✓ хранит пароль как Argon2id-хеш, а не открытым текстом (287 ms)
POST /api/v1/auth/sessions
✓ выдаёт непрозрачный Bearer-токен с expires_at и пользователем (298 ms)
✓ принимает пароль с двоеточием и не-ASCII символами (81 ms)
✓ отвечает одинаковым 401 на неверный пароль и неизвестного пользователя (452 ms)
✓ отклоняет JSON body при входе даже с верным Basic (133 ms)
✓ отвечает 401 без заголовка Authorization (13 ms)
✓ выдаёт непрозрачный Bearer-токен с expires_at и пользователем (511 ms)
✓ принимает пароль с двоеточием и не-ASCII символами (128 ms)
✓ отвечает одинаковым 401 на неверный пароль и неизвестного пользователя (285 ms)
✓ отклоняет JSON body при входе даже с верным Basic (84 ms)
✓ отвечает 401 без заголовка Authorization (6 ms)
защищённые endpoint
✓ не принимают Basic (126 ms)
✓ не принимают Basic (99 ms)
✓ не принимают X-User-Id сам по себе (114 ms)
✓ игнорируют X-User-Id рядом с Bearer (219 ms)
✓ отвечают 401 на неизвестный токен (13 ms)
✓ игнорируют X-User-Id рядом с Bearer (151 ms)
✓ отвечают 401 на неизвестный токен (5 ms)
DELETE /api/v1/auth/sessions/current
✓ отзывает только текущий токен: 204, затем 401 на повтор (211 ms)
✓ отзывает только текущий токен: 204, затем 401 на повтор (110 ms)
PASS test/idempotency.e2e-spec.ts (11.29 s)
PASS test/idempotency.e2e-spec.ts (11.296 s)
Идемпотентность отправки и X-Instance-Id (e2e)
✓ требует Idempotency-Key правильного формата (429 ms)
✓ повтор с тем же ключом и телом возвращает тот же 201 и то же сообщение (402 ms)
✓ тот же ключ с другим телом — 409, сообщение не создаётся (586 ms)
✓ 20 параллельных запросов с одним ключом через два экземпляра создают ровно одно сообщение (363 ms)
✓ область ключа — пользователь и чат: одинаковый ключ у разных пользователей и чатов независим (182 ms)
✓ повтор заново проверяет сессию (94 ms)
✓ после IDEMPOTENCY_TTL_SECONDS ключ можно использовать заново (1676 ms)
✓ X-Instance-Id есть в успешных ответах, ошибках и health и стабилен в процессе (9 ms)
✓ требует Idempotency-Key правильного формата (315 ms)
✓ повтор с тем же ключом и телом возвращает тот же 201 и то же сообщение (780 ms)
✓ тот же ключ с другим телом — 409, сообщение не создаётся (315 ms)
✓ 20 параллельных запросов с одним ключом через два экземпляра создают ровно одно сообщение (311 ms)
✓ область ключа — пользователь и чат: одинаковый ключ у разных пользователей и чатов независим (154 ms)
✓ повтор заново проверяет сессию (84 ms)
✓ после IDEMPOTENCY_TTL_SECONDS ключ можно использовать заново (1613 ms)
✓ X-Instance-Id есть в успешных ответах, ошибках и health и стабилен в процессе (12 ms)
[Nest] 175 - 11/01/2026, 2:24:12 PM  ERROR [HttpExceptionFilter] DELETE /api/v1/auth/sessions/current -> 503: session cache unavailable
[Nest] 175 - 11/01/2026, 2:24:12 PM  ERROR [HttpExceptionFilter] DELETE /api/v1/auth/sessions/current -> 503: session cache unavailable
[Nest] 175 - 11/01/2026, 2:24:13 PM  ERROR [HttpExceptionFilter] GET /health/ready -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:24:13 PM  ERROR [HttpExceptionFilter] GET /api/v1/chats -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:24:13 PM  ERROR [HttpExceptionFilter] GET /api/v1/chats -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:24:13 PM  ERROR [HttpExceptionFilter] POST /api/v1/users -> 503: database unavailable
PASS test/api.e2e-spec.ts (12.31 s)
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] DELETE /api/v1/auth/sessions/current -> 503: session cache unavailable
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] DELETE /api/v1/auth/sessions/current -> 503: session cache unavailable
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] GET /health/ready -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] GET /api/v1/chats -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] GET /api/v1/chats -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] POST /api/v1/users -> 503: database unavailable
[Nest] 175 - 11/01/2026, 2:53:46 PM  ERROR [HttpExceptionFilter] GET /api/v1/chats -> 500: Internal server error
PASS test/failures.e2e-spec.ts (12.601 s)
Уровень 4: expiry, отказы зависимостей, rollback (e2e)
✓ сессия истекает при коротком SESSION_TTL_SECONDS, в том числе из кэша (3576 ms)
✓ без Redis вход и проверка сессии работают через PostgreSQL, logout — 503 без отзыва (210 ms)
✓ logout через реплику без связи с Redis не создаёт расхождения с репликой, у которой сессия в кэше (412 ms)
✓ без PostgreSQL отвечает ограниченным 503 и не пускает анонима (232 ms)
✓ неожиданное исключение — 500 internal_error без деталей, с X-Request-Id и X-Instance-Id (107 ms)
✓ откатывает создание чата целиком, если один из участников не существует (103 ms)
PASS test/api.e2e-spec.ts (12.801 s)
API мессенджера (e2e) — граничные случаи сверх публичного smoke
POST /api/v1/users
✓ отклоняет некорректный JSON с кодом 400 (75 ms)
✓ отклоняет тело с лишними полями (26 ms)
✓ отклоняет username с заглавными буквами (7 ms)
✓ отклоняет display_name из одних пробелов (6 ms)
✓ отклоняет дубликат username с кодом 409 (319 ms)
✓ никогда не возвращает поле пароля или его хэша (57 ms)
✓ отклоняет некорректный JSON с кодом 400 (84 ms)
✓ отклоняет тело с лишними полями (32 ms)
✓ отклоняет username с заглавными буквами (8 ms)
✓ отклоняет display_name из одних пробелов (7 ms)
✓ отклоняет дубликат username с кодом 409 (809 ms)
✓ никогда не возвращает поле пароля или его хэша (60 ms)
✓ отклоняет username короче 3 символов (6 ms)
✓ отклоняет username длиннее 32 символов (6 ms)
✓ отклоняет username с недопустимыми символами (дефис) (6 ms)
✓ отклоняет username с недопустимыми символами (дефис) (9 ms)
✓ принимает username ровно на границах длины 3 и 32 символа (81 ms)
✓ отклоняет display_name длиннее 100 Unicode code points (5 ms)
✓ принимает display_name ровно из 100 code points, считая эмодзи вне BMP за один символ (47 ms)
✓ отклоняет display_name из 101 code point, состоящий из эмодзи вне BMP (3 ms)
✓ принимает display_name ровно из 100 code points, считая эмодзи вне BMP за один символ (41 ms)
✓ отклоняет display_name из 101 code point, состоящий из эмодзи вне BMP (6 ms)
контроль доступа
✓ возвращает 401 раньше 404, если и актор, и ресурс невалидны (8 ms)
✓ возвращает 404 (не 403), когда чат запрашивает не его участник (844 ms)
✓ отклоняет создание чата, если вызывающий не входит в member_ids (267 ms)
✓ отклоняет создание чата с дублирующимися member_ids (113 ms)
✓ считает один UUID в разном регистре дубликатом и узнаёт вызывающего в верхнем регистре (81 ms)
✓ принимает ровно 100 участников и отклоняет 101 (108 ms)
✓ отклоняет создание чата с неизвестным участником (81 ms)
✓ отклоняет создание чата с пустым/пробельным title (77 ms)
✓ возвращает 400 для синтаксически некорректного chat_id (не UUID) (89 ms)
✓ возвращает 404 для корректного по формату, но несуществующего chat_id (86 ms)
✓ возвращает 401 раньше 404, если и актор, и ресурс невалидны (11 ms)
✓ возвращает 404 (не 403), когда чат запрашивает не его участник (633 ms)
✓ отклоняет создание чата, если вызывающий не входит в member_ids (126 ms)
✓ отклоняет создание чата с дублирующимися member_ids (66 ms)
✓ считает один UUID в разном регистре дубликатом и узнаёт вызывающего в верхнем регистре (63 ms)
✓ принимает ровно 100 участников и отклоняет 101 (75 ms)
✓ отклоняет создание чата с неизвестным участником (65 ms)
✓ отклоняет создание чата с пустым/пробельным title (60 ms)
✓ возвращает 400 для синтаксически некорректного chat_id (не UUID) (59 ms)
✓ возвращает 404 для корректного по формату, но несуществующего chat_id (56 ms)
GET /api/v1/chats (пагинация)
✓ использует limit=50 по умолчанию, если limit не передан (83 ms)
✓ отклоняет нечисловой limit (60 ms)
✓ отклоняет limit=0 (65 ms)
✓ отклоняет повторённые limit и cursor (67 ms)
✓ отклоняет cursor, не являющийся корректным base64url JSON (65 ms)
✓ отклоняет корректно закодированный cursor с id чата, который никогда не существовал (63 ms)
✓ обходит весь список чатов по страницам без пропусков и дублей (102 ms)
✓ использует limit=50 по умолчанию, если limit не передан (67 ms)
✓ отклоняет нечисловой limit (59 ms)
✓ отклоняет limit=0 (68 ms)
✓ отклоняет повторённые limit и cursor (66 ms)
✓ отклоняет cursor, не являющийся корректным base64url JSON (61 ms)
✓ отклоняет корректно закодированный cursor с id чата, который никогда не существовал (58 ms)
✓ обходит весь список чатов по страницам без пропусков и дублей (91 ms)
сообщения
✓ не принимает sender_id, переданный клиентом (124 ms)
✓ считает attachment_ids: [] равным отсутствию поля, непустой список отклоняет (145 ms)
✓ отклоняет пустое сообщение (101 ms)
✓ отклоняет сообщение из одних пробелов (114 ms)
✓ отклоняет отправку в чат, где вызывающий не участник (158 ms)
✓ отклоняет limit=0 при чтении истории (98 ms)
✓ отклоняет limit=101 при чтении истории (115 ms)
✓ отклоняет нечисловой limit (111 ms)
✓ отклоняет текст сообщения длиннее 4000 Unicode code points (99 ms)
✓ принимает текст сообщения ровно из 4000 Unicode code points (110 ms)
✓ отклоняет текст сообщения свыше 4000 code points, состоящий из эмодзи вне BMP (112 ms)
✓ отклоняет cursor, не являющийся корректным base64url JSON (112 ms)
✓ отклоняет корректно закодированный cursor с id сообщения, которое никогда не существовало в этом чате (120 ms)
✓ возвращает 400 для синтаксически некорректного chat_id при отправке сообщения (47 ms)
✓ возвращает 400 для синтаксически некорректного chat_id при чтении истории (49 ms)
✓ отклоняет cursor, взятый из другого чата (137 ms)
✓ обходит всю историю по страницам без пропусков и дублей (158 ms)
✓ не принимает sender_id, переданный клиентом (113 ms)
✓ считает attachment_ids: [] равным отсутствию поля, непустой список отклоняет (142 ms)
✓ отклоняет пустое сообщение (120 ms)
✓ отклоняет сообщение из одних пробелов (116 ms)
✓ отклоняет отправку в чат, где вызывающий не участник (157 ms)
✓ отклоняет limit=0 при чтении истории (123 ms)
✓ отклоняет limit=101 при чтении истории (103 ms)
✓ отклоняет нечисловой limit (125 ms)
✓ отклоняет текст сообщения длиннее 4000 Unicode code points (177 ms)
✓ принимает текст сообщения ровно из 4000 Unicode code points (196 ms)
✓ отклоняет текст сообщения свыше 4000 code points, состоящий из эмодзи вне BMP (119 ms)
✓ отклоняет cursor, не являющийся корректным base64url JSON (122 ms)
✓ отклоняет корректно закодированный cursor с id сообщения, которое никогда не существовало в этом чате (139 ms)
✓ возвращает 400 для синтаксически некорректного chat_id при отправке сообщения (63 ms)
✓ возвращает 400 для синтаксически некорректного chat_id при чтении истории (68 ms)
✓ отклоняет cursor, взятый из другого чата (157 ms)
✓ обходит всю историю по страницам без пропусков и дублей (161 ms)
X-Request-Id
✓ присутствует и уникален для независимых запросов (2 ms)
✓ совпадает с request_id внутри тела ошибки (2 ms)
[Nest] 175 - 11/01/2026, 2:24:13 PM  ERROR [HttpExceptionFilter] GET /api/v1/chats -> 500: Internal server error
PASS test/failures.e2e-spec.ts (12.501 s)
Уровень 4: expiry, отказы зависимостей, rollback (e2e)
✓ сессия истекает при коротком SESSION_TTL_SECONDS, в том числе из кэша (3629 ms)
✓ без Redis вход и проверка сессии работают через PostgreSQL, logout — 503 без отзыва (162 ms)
✓ logout через реплику без связи с Redis не создаёт расхождения с репликой, у которой сессия в кэше (343 ms)
✓ без PostgreSQL отвечает ограниченным 503 и не пускает анонима (269 ms)
✓ неожиданное исключение — 500 internal_error без деталей, с X-Request-Id и X-Instance-Id (89 ms)
✓ откатывает создание чата целиком, если один из участников не существует (105 ms)
✓ присутствует и уникален для независимых запросов (3 ms)
✓ совпадает с request_id внутри тела ошибки (1 ms)
A worker process has failed to exit gracefully and has been force exited. This is likely caused by tests leaking due to improper teardown. Try running with --detectOpenHandles to find leaks. Active timers can also cause this, ensure that .unref() was called on them.
Test Suites: 6 passed, 6 total
Tests: 80 passed, 80 total
Snapshots: 0 total
Time: 13.518 s
Time: 13.86 s
Ran all test suites.