14 KiB
3: публичные smoke, persistence и failover
Что проверяется
Оригинальные публичные сценарии проходят, failover наблюдает две реплики; persistence использует прежнюю сессию после рестарта API/БД/Redis.
Статус выполнения проверок: PASS. Для исследования PASS означает успешную проверку данных и правил анализа; решение гипотезы указано отдельно и может быть неопределённым.
Запуск: lab3-report-04. Команды выполнены из корня проекта в WSL; время и версии указаны в manifest.
Команды и фактический вывод
structure
Проверка приложения.
make check
Начало UTC: 2026-10-10T16:21:01.259598+00:00; конец UTC: 2026-10-10T16:21:17.223778+00:00; exit code: 0.
Вывод команды:
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/structure.txt.
smoke
Проверка приложения.
make test
Начало UTC: 2026-10-10T16:21:20.452226+00:00; конец UTC: 2026-10-10T16:21:28.356351+00:00; exit code: 0.
Вывод команды:
python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab3 public API scenario; infrastructure and grading evidence remain separate.
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/smoke.txt.
backend
Проверка приложения.
make test-backend
Начало UTC: 2026-10-10T16:21:28.367462+00:00; конец UTC: 2026-10-10T16:22:48.382135+00:00; exit code: 0.
Фрагмент вывода; полный журнал доступен по ссылке ниже.
docker compose --project-name highload-lab3 --env-file .env -f compose.yml --profile test run --build --rm backend-tests
Container highload-lab3-db-1 Running
Container highload-lab3-redis-1 Running
Image highload-lab3-backend-tests Building
#1 [internal] load local bake definitions
#1 reading from stdin 629B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 661B 0.0s done
#2 DONE 0.1s
#3 [internal] load metadata for docker.io/library/golang:1.22.2-bookworm
#3 DONE 0.1s
#4 [internal] load .dockerignore
#4 transferring context: 268B 0.0s done
#4 DONE 0.0s
#5 [builder 1/6] FROM docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f
#5 resolve docker.io/library/golang:1.22.2-bookworm@sha256:d0902bacefdde1cf45528c098d14e55d78c107def8a22d148eabd71582d7a99f 0.0s done
#5 DONE 0.0s
#6 [internal] load build context
#6 transferring context: 2.49kB 0.2s done
#6 DONE 0.2s
#7 [builder 4/6] RUN go mod download
#7 CACHED
#8 [builder 5/6] COPY backend ./backend
#8 CACHED
#9 [builder 2/6] WORKDIR /src
#9 CACHED
#10 [builder 3/6] COPY go.mod go.sum ./
#10 CACHED
#11 [builder 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /out/messenger ./backend
#11 CACHED
#12 exporting to image
#12 exporting layers done
#12 exporting manifest sha256:4bd45c73a0da989b49052aa8050de520bf58aec57ea4df0596741bae3c1224d7 done
#12 exporting config sha256:37436eaab83b2bd6086c7f26cc412f7df6ae3d992339866ca29907f65fd1e477 done
#12 exporting attestation manifest sha256:17297671d082e07cef2ee562c0b963492b727f6ecc2e64f266de8a57c776b545 0.0s done
#12 exporting manifest list sha256:ba973aacf88dff80976bad611e00fa3eb970c5ccb39e0657d08f1da32254b315 0.0s done
#12 naming to docker.io/library/highload-lab3-backend-tests:latest done
#12 unpacking to docker.io/library/highload-lab3-backend-tests:latest 0.0s done
#12 DONE 0.2s
#13 resolving provenance for metadata file
#13 DONE 0.0s
Image highload-lab3-backend-tests Built
Container highload-lab3-redis-1 Waiting
Container highload-lab3-db-1 Waiting
Container highload-lab3-db-1 Healthy
Container highload-lab3-redis-1 Healthy
Container highload-lab3-backend-tests-run-e074c1f99f21 Creating
Container highload-lab3-backend-tests-run-e074c1f99f21 Created
? messenger/src/backend [no test files]
? messenger/src/backend/handlers [no test files]
? messenger/src/backend/repositories [no test files]
? messenger/src/backend/services [no test files]
=== RUN TestConcurrentMessageCreation
--- PASS: TestConcurrentMessageCreation (3.81s)
=== RUN TestConcurrentRegistrationSameUsername
--- PASS: TestConcurrentRegistrationSameUsername (1.77s)
=== RUN TestChatTransactionRollsBackAfterMemberInsertFailure
... [пропущенные строки — в полном журнале] ...
=== RUN TestMessageLessUsesIDForEqualTimestamps
--- PASS: TestMessageLessUsesIDForEqualTimestamps (0.00s)
=== RUN TestListPageByChatUsesCursorAndLimit
--- PASS: TestListPageByChatUsesCursorAndLimit (0.47s)
=== RUN TestListPageByChatReturnsNonNilEmptyPage
--- PASS: TestListPageByChatReturnsNonNilEmptyPage (0.14s)
=== RUN TestPasswordKDFUsesSaltAndFullUTF8Password
--- PASS: TestPasswordKDFUsesSaltAndFullUTF8Password (1.28s)
=== RUN TestStoredPasswordUsesArgon2id
--- PASS: TestStoredPasswordUsesArgon2id (0.43s)
=== RUN TestBearerRequiredIgnoresXUserID
--- PASS: TestBearerRequiredIgnoresXUserID (0.00s)
=== RUN TestMessageCursorPreservesPosition
--- PASS: TestMessageCursorPreservesPosition (0.00s)
=== RUN TestCreateUserInvalidJSON
--- PASS: TestCreateUserInvalidJSON (0.00s)
=== RUN TestCreateUserDuplicateUsername
--- PASS: TestCreateUserDuplicateUsername (0.79s)
PASS
ok messenger/src/backend/tests 21.998s
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/backend.txt.
vet
Проверка приложения.
docker compose --project-name highload-lab3 --env-file .env -f compose.yml run --rm --no-deps backend-tests go vet ./backend/...
Начало UTC: 2026-10-10T16:22:48.419063+00:00; конец UTC: 2026-10-10T16:23:37.724327+00:00; exit code: 0.
Вывод команды:
Container highload-lab3-backend-tests-run-a55be077749a Creating
Container highload-lab3-backend-tests-run-a55be077749a Created
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/vet.txt.
frontend-build
Проверка приложения.
docker compose --project-name highload-lab3 --env-file .env -f compose.yml exec -T frontend npm run build
Начало UTC: 2026-10-10T16:23:37.753497+00:00; конец UTC: 2026-10-10T16:23:44.707046+00:00; exit code: 0.
Вывод команды:
> messenger-test-ui@1.0.0 build
> tsc --noEmit && vite build
vite v8.3.0 building client environment for production...
transforming...
✓ 19 modules transformed.
rendering chunks...
computing gzip size...
dist/index.html 0.42 kB │ gzip: 0.31 kB
dist/assets/index-CtrGgTvu.css 8.42 kB │ gzip: 2.49 kB
dist/assets/index-mGBRH-qW.js 234.07 kB │ gzip: 73.40 kB
✓ built in 1.51s
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/frontend-build.txt.
persistence
Проверка приложения.
make test-persistence ACTION_SCRIPT=scripts/restart.sh
Начало UTC: 2026-10-10T16:25:08.655281+00:00; конец UTC: 2026-10-10T16:25:25.938120+00:00; exit code: 0.
Вывод команды:
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8080"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/persistence.txt.
public-failover
Проверка приложения.
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
Начало UTC: 2026-10-10T16:25:25.948528+00:00; конец UTC: 2026-10-10T16:25:46.886847+00:00; exit code: 0.
Вывод команды:
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://localhost:8080"
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
{"observed_instances_before": 2, "successful_writes": 126, "failed_attempts": 2, "first_recovery_seconds": 1.661}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/public-failover.txt.
restore
Проверка приложения.
docker compose --project-name highload-lab3 --env-file .env -f compose.yml up -d --wait
Начало UTC: 2026-10-10T16:26:22.053178+00:00; конец UTC: 2026-10-10T16:26:30.498837+00:00; exit code: 0.
Вывод команды:
Container highload-lab3-api-15 Running
Container highload-lab3-haproxy-1 Running
Container highload-lab3-frontend-1 Running
Container highload-lab3-redis-1 Running
Container highload-lab3-db-1 Running
Container highload-lab3-db-1 Waiting
Container highload-lab3-db-1 Healthy
Container highload-lab3-migrate-1 Starting
Container highload-lab3-migrate-1 Started
Container highload-lab3-db-1 Waiting
Container highload-lab3-redis-1 Waiting
Container highload-lab3-migrate-1 Waiting
Container highload-lab3-migrate-1 Exited
Container highload-lab3-db-1 Healthy
Container highload-lab3-redis-1 Healthy
Container highload-lab3-api-14 Starting
Container highload-lab3-api-14 Started
Container highload-lab3-api-15 Waiting
Container highload-lab3-api-14 Waiting
Container highload-lab3-api-15 Healthy
Container highload-lab3-api-14 Healthy
Container highload-lab3-haproxy-1 Waiting
Container highload-lab3-haproxy-1 Healthy
Container highload-lab3-db-1 Waiting
Container highload-lab3-migrate-1 Waiting
Container highload-lab3-api-15 Waiting
Container highload-lab3-api-14 Waiting
Container highload-lab3-haproxy-1 Waiting
Container highload-lab3-frontend-1 Waiting
Container highload-lab3-redis-1 Waiting
Container highload-lab3-db-1 Healthy
Container highload-lab3-haproxy-1 Healthy
Container highload-lab3-frontend-1 Healthy
Container highload-lab3-migrate-1 Exited
Container highload-lab3-redis-1 Healthy
Container highload-lab3-api-15 Healthy
Container highload-lab3-api-14 Healthy
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/restore.txt.
final-inventory
Проверка приложения.
python3 scripts/generate_evidence.py --inspect
Начало UTC: 2026-10-10T16:26:30.526830+00:00; конец UTC: 2026-10-10T16:26:32.003643+00:00; exit code: 0.
Фрагмент вывода; полный журнал доступен по ссылке ниже.
{
"containers": [
{
"service": "api",
"instance": "2fcedadb893e",
"state": "running",
"exit_code": 0,
"health": "healthy",
"cpu": 500000000,
"memory": 134217728,
"ports": {},
"networks": {
"highload-lab3_data": {
"address": "172.25.0.4"
},
"highload-lab3_proxy": {
"address": "172.24.0.3"
}
},
"image": "sha256:d4ba271b288da51c1190a01305f64639308bbc420108e0b79561235c049a3b4a",
"started": "2026-10-10T16:26:23.932036229Z",
"container_id": "2fcedadb893e9548fb08a124704944a0fa885fd24e3d22366704a5ea3d8583fc",
"gomaxprocs": "1"
},
{
"service": "api",
"instance": "e057f7d85be3",
"state": "running",
"exit_code": 0,
"health": "healthy",
"cpu": 500000000,
"memory": 134217728,
"ports": {},
"networks": {
"highload-lab3_data": {
"address": "172.25.0.5"
},
"highload-lab3_proxy": {
"address": "172.24.0.2"
}
},
"image": "sha256:d4ba271b288da51c1190a01305f64639308bbc420108e0b79561235c049a3b4a",
"started": "2026-10-10T16:25:19.574614979Z",
"container_id": "e057f7d85be33bb7836b462bdec3ef9115b2dae2a1c25107edfe27b3ee268a2f",
"gomaxprocs": "1"
},
{
"service": "db",
"instance": "edfcf3091ee4",
"state": "running",
"exit_code": 0,
"health": "healthy",
"cpu": 1000000000,
"memory": 536870912,
"ports": {},
"networks": {
"highload-lab3_data": {
"address": "172.25.0.2"
}
},
"image": "sha256:38471f330eb885e04de130b768d6db4e10469e2311879c7e5c699f6d2d8a1c74",
"started": "2026-10-10T16:25:14.885950406Z",
"container_id": "edfcf3091ee410c68a4d6845fee0aaed1477744abba90d7b6de8dffbfe51f05c"
},
{
"service": "frontend",
"instance": "ceb091ff4cee",
"state": "running",
"exit_code": 0,
"health": "healthy",
... [пропущенные строки — в полном журнале] ...
"path": "/health/ready",
"status": 200,
"instance": "e057f7d85be3"
}
],
"migration_version_dirty": "3|f",
"git_ignored": [
".env",
".memory/"
],
"hook_scope": {
"restart.sh": {
"sha256": "0bdb05ec336f4e175ab2a76f172fcab06512003f70962adcd3e4c64567da1c43"
},
"stop-one.sh": {
"sha256": "6eda7ff0eaaf521a2510e3b4ea2675ec7cd44851aeedf7300ca099ade9fa46f8"
}
}
}
PASS: actual containers and HAProxy addresses agree; migration 3 clean; storage/API private; secrets ignored
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/final-inventory.txt.