Evidence from 4e0cc4e: stand ports, limits and per-service env,
X-Instance-Id distribution and scaling, LB-generated errors,
test-persistence through the LB, test-failover for each replica in stop
and kill modes, stop-one refusals, test runs and bench self-checks.
REPORT.md gains the LB architecture, timeout chain, limits, criteria
rows and defence answers. Coverage exclusions for restart now point to
the lab 3 persistence evidence; stale lab 2 pointers go to
KNOWN_ISSUES.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
4.4 KiB
Markdown
80 lines
4.4 KiB
Markdown
# `scripts/stop-one.sh`: отказ на чужой или неверный `TARGET_INSTANCE_ID`
|
||
|
||
| | |
|
||
|---|---|
|
||
| Спеки | `load-balancing` «Failover hook» — «Чужой или неизвестный id» |
|
||
| Change | `replicas-lb`, задача 6.1 |
|
||
| Дата | 2026-10-10 15:12:14–15:12:20 UTC |
|
||
| Commit | `4e0cc4e` |
|
||
| Стенд | `make run_docker`: проект `mtusi-lab3`, HAProxy на `127.0.0.1:8080`, `api` × 2 (восстановлены `make replicas` после `test-failover-kill.md`) |
|
||
| Хост | Docker Desktop 29.8.1, macOS arm64; ВМ Docker: 12 CPU, 7,7 GiB RAM; ноутбук от батареи |
|
||
|
||
Скрипт проверяет формат (hex, 12–64 символа) до вызова docker и ищет
|
||
ID префиксом только среди работающих реплик `api` этого проекта
|
||
(`docker compose ps -q api`). Postgres, Valkey, LB, `migrate` и
|
||
контейнеры других проектов в этот список не входят.
|
||
|
||
```text
|
||
$ ps (до)
|
||
api /mtusi-lab3-api-1 0a93eeb192b4 running exit=0 started=2026-10-10T15:12:10.2792805Z
|
||
api /mtusi-lab3-api-2 47a14cfd6cd7 running exit=0 started=2026-10-10T15:10:02.032020261Z
|
||
haproxy /mtusi-lab3-haproxy-1 5ab61b8f1958 running exit=0 started=2026-10-10T15:07:49.288248255Z
|
||
migrate /mtusi-lab3-migrate-1 7932e099b9f9 exited exit=0 started=2026-10-10T15:07:47.582119254Z
|
||
postgres /mtusi-lab3-postgres-1 e32b3661ee3a running exit=0 started=2026-10-10T15:07:45.738258545Z
|
||
valkey /mtusi-lab3-valkey-1 ae69bdd041cb running exit=0 started=2026-10-10T15:07:45.76904342Z
|
||
|
||
$ unset TARGET_INSTANCE_ID; scripts/stop-one.sh
|
||
scripts/stop-one.sh: line 17: TARGET_INSTANCE_ID: test provides target API instance alias
|
||
exit=1
|
||
$ TARGET_INSTANCE_ID='' scripts/stop-one.sh
|
||
scripts/stop-one.sh: line 17: TARGET_INSTANCE_ID: test provides target API instance alias
|
||
exit=1
|
||
$ TARGET_INSTANCE_ID='API-1' scripts/stop-one.sh
|
||
stop-one: TARGET_INSTANCE_ID is not a container id
|
||
exit=2
|
||
$ TARGET_INSTANCE_ID='zz12345678901' scripts/stop-one.sh
|
||
stop-one: TARGET_INSTANCE_ID is not a container id
|
||
exit=2
|
||
$ TARGET_INSTANCE_ID='abc123' scripts/stop-one.sh # короче 12 символов
|
||
stop-one: TARGET_INSTANCE_ID is not a container id
|
||
exit=2
|
||
$ TARGET_INSTANCE_ID='e32b3661ee3a' scripts/stop-one.sh # postgres этого стенда
|
||
stop-one: no running api replica of this project matches TARGET_INSTANCE_ID
|
||
exit=3
|
||
$ TARGET_INSTANCE_ID='ae69bdd041cb' scripts/stop-one.sh # valkey
|
||
stop-one: no running api replica of this project matches TARGET_INSTANCE_ID
|
||
exit=3
|
||
$ TARGET_INSTANCE_ID='5ab61b8f1958' scripts/stop-one.sh # haproxy
|
||
stop-one: no running api replica of this project matches TARGET_INSTANCE_ID
|
||
exit=3
|
||
$ TARGET_INSTANCE_ID='7932e099b9f9' scripts/stop-one.sh # migrate
|
||
stop-one: no running api replica of this project matches TARGET_INSTANCE_ID
|
||
exit=3
|
||
$ TARGET_INSTANCE_ID='0123456789ab' scripts/stop-one.sh # несуществующий
|
||
stop-one: no running api replica of this project matches TARGET_INSTANCE_ID
|
||
exit=3
|
||
$ TARGET_INSTANCE_ID=0a93eeb192b4 STOP_MODE=pause scripts/stop-one.sh
|
||
stop-one: STOP_MODE must be stop or kill
|
||
exit=2
|
||
|
||
$ ps (после)
|
||
api /mtusi-lab3-api-1 0a93eeb192b4 running exit=0 started=2026-10-10T15:12:10.2792805Z
|
||
api /mtusi-lab3-api-2 47a14cfd6cd7 running exit=0 started=2026-10-10T15:10:02.032020261Z
|
||
haproxy /mtusi-lab3-haproxy-1 5ab61b8f1958 running exit=0 started=2026-10-10T15:07:49.288248255Z
|
||
migrate /mtusi-lab3-migrate-1 7932e099b9f9 exited exit=0 started=2026-10-10T15:07:47.582119254Z
|
||
postgres /mtusi-lab3-postgres-1 e32b3661ee3a running exit=0 started=2026-10-10T15:07:45.738258545Z
|
||
valkey /mtusi-lab3-valkey-1 ae69bdd041cb running exit=0 started=2026-10-10T15:07:45.76904342Z
|
||
|
||
# сразу после — ID контейнера другого проекта
|
||
$ TARGET_INSTANCE_ID=e352c514d163 scripts/stop-one.sh # api проекта mtusi-lab2
|
||
stop-one: no running api replica of this project matches TARGET_INSTANCE_ID
|
||
exit=3
|
||
$ docker inspect -f '{{.State.Status}} {{.State.FinishedAt}}' mtusi-lab2-api-1
|
||
exited 2026-10-02T18:56:42.98517984Z
|
||
```
|
||
|
||
Все отказы — с ненулевым кодом; `StartedAt` и состояние каждого
|
||
контейнера стенда до и после совпадают. Контейнер второй лабы
|
||
(`mtusi-lab2-api-1`, остановлен 2026-10-02) скрипт тоже не трогает:
|
||
его нет в `docker compose ps -q api` этого проекта.
|