forked from mtusi2026/mtusi2026lab3
Реализовать Lab 3: балансировка и отказоустойчивость
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
Command: docker compose --env-file .env config --quiet
|
||||
Exit code: 0
|
||||
Stdout: (empty)
|
||||
@@ -0,0 +1,4 @@
|
||||
Command: docker compose --env-file .env up -d --build --scale api=2; docker compose --env-file .env ps
|
||||
Result: API image built; the one-shot migration job exited 0; postgres, redis, api-1, api-2 and lb became healthy.
|
||||
LB bound to 127.0.0.1:8081. API, PostgreSQL and Redis host ports are not published.
|
||||
Images: python:3.12.8-slim, postgres:16.4-alpine, redis:7.4.2-alpine, nginx:1.27.4-alpine.
|
||||
@@ -0,0 +1,5 @@
|
||||
Date: 2026-10-27
|
||||
Command: make check (Ubuntu WSL)
|
||||
Output:
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,5 @@
|
||||
Date: 2026-10-27
|
||||
Command: make test-idempotency BASE_URL=http://127.0.0.1:8081 (Ubuntu WSL)
|
||||
Output:
|
||||
python3 tests/idempotency.py --base-url "http://127.0.0.1:8081"
|
||||
PASS: 16 concurrent requests across 2 API replicas returned one Message; changed body returned 409.
|
||||
@@ -0,0 +1,5 @@
|
||||
Date: 2026-10-27
|
||||
Command: make test BASE_URL=http://127.0.0.1:8081 (Ubuntu WSL; port 8081 is the local override while Lab 2 is already running on 8080)
|
||||
Output:
|
||||
python3 tests/smoke.py --base-url "http://127.0.0.1:8081"
|
||||
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,5 @@
|
||||
Date: 2026-10-27
|
||||
Command: make validate PYTHON=/home/lenovo/lab2/.venv/bin/python (Ubuntu WSL)
|
||||
Output:
|
||||
/home/lenovo/lab2/.venv/bin/python scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
@@ -0,0 +1,6 @@
|
||||
Commands: docker compose --env-file .env run --rm migrate (twice); query schema_migrations
|
||||
Output versions:
|
||||
1
|
||||
2
|
||||
3
|
||||
Both reruns exited 0; migration version rows were not duplicated.
|
||||
@@ -0,0 +1,3 @@
|
||||
Commands: sh -n scripts/restart.sh; sh -n scripts/stop-one.sh
|
||||
Output:
|
||||
PASS: POSIX hook syntax
|
||||
@@ -0,0 +1,9 @@
|
||||
Date: 2026-10-27
|
||||
Code under test before squash: a74e32e
|
||||
Command: make test-failover ACTION_SCRIPT=scripts/stop-one.sh BASE_URL=http://127.0.0.1:8081 (Ubuntu WSL; tracked POSIX hook)
|
||||
Output:
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://127.0.0.1:8081"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 140, "failed_attempts": 0, "first_recovery_seconds": 0.673}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
The test stopped the selected API container; the stopped replica was restored after the check.
|
||||
@@ -0,0 +1,8 @@
|
||||
Date: 2026-10-27
|
||||
Code under test before squash: a74e32e
|
||||
Command: make test-persistence ACTION_SCRIPT=scripts/restart.sh BASE_URL=http://127.0.0.1:8081 (Ubuntu WSL; tracked POSIX hook)
|
||||
Output:
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://127.0.0.1:8081"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
The hook restarted PostgreSQL, Redis, both API replicas and Nginx. Named volumes were retained.
|
||||
@@ -0,0 +1,6 @@
|
||||
Дата и время: 2026-10-27, Europe/Moscow
|
||||
Ревизия исходников под проверкой до squash: a74e32e; содержимое исходников и Compose при squash не менялось.
|
||||
Docker Desktop Linux: 32 vCPU; 16 598 642 688 bytes RAM доступно Docker.
|
||||
Лимит API: 1 CPU и 536 870 912 bytes памяти на реплику; запущено две реплики.
|
||||
Профили: публичный smoke на синтетических данных; идемпотентность — 16 одновременных запросов с одним ключом; persistence — restart API/PostgreSQL/Redis/LB с сохранёнными volumes; failover — 15-секундный поток POST, 140 успешных ответов, 0 переходных ошибок, первая успешная запись через 0.673 секунды.
|
||||
Failover — проверка критерия уровня 3, не нагрузочный benchmark; throughput и p95/p99 не заявляются.
|
||||
Reference in New Issue
Block a user