8.3 KiB
3: общая идемпотентность сообщений
Что проверяется
24 конкурентных POST с одним ключом через разные API возвращают одно сообщение; проверяются конфликт тела, область ключа и повтор после переключения реплики.
Статус выполнения проверок: PASS. Для исследования PASS означает успешную проверку данных и правил анализа; решение гипотезы указано отдельно и может быть неопределённым.
Запуск: lab3-report-04. Команды выполнены из корня проекта в WSL; время и версии указаны в manifest.
Команды и фактический вывод
idempotency
Проверка приложения.
python3 scripts/check_idempotency.py
Начало UTC: 2026-10-10T16:23:44.736019+00:00; конец UTC: 2026-10-10T16:23:50.648039+00:00; exit code: 0.
Вывод команды:
{"concurrent_requests": 24, "observed_instances": ["04f3baa4775a", "4864ca4d784f"], "messages_after_concurrent_repeat": 1}
PASS: shared session, concurrent replay across replicas, key/body validation, independent scopes, reauthentication on replay
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/idempotency.txt.
failover
Проверка приложения.
python3 scripts/check_failover.py
Начало UTC: 2026-10-10T16:23:50.669521+00:00; конец UTC: 2026-10-10T16:24:40.149403+00:00; exit code: 0.
Вывод команды:
{"stopped_instance": "04f3baa4775a", "container_state": "exited", "successful_writes": 117, "successful_reads": 121, "write_errors": 4, "read_errors": 0, "first_write_seconds": 1.817, "first_read_seconds": 1.702, "elapsed_seconds": 15.061, "lb_exclusion_seconds": 1.806, "successful_rps": 15.802, "attempted_rps": 16.067, "workload": "one sequential writer and reader, 100ms pause; not a capacity benchmark"}
Container highload-lab3-api-13 Running
Container highload-lab3-api-12 Starting
Container highload-lab3-api-12 Started
Container highload-lab3-api-13 Waiting
Container highload-lab3-api-12 Waiting
Container highload-lab3-api-13 Healthy
Container highload-lab3-api-12 Healthy
{"stopped_instance": "4864ca4d784f", "container_state": "exited", "successful_writes": 118, "successful_reads": 122, "write_errors": 4, "read_errors": 0, "first_write_seconds": 1.835, "first_read_seconds": 1.722, "elapsed_seconds": 15.086, "lb_exclusion_seconds": 1.825, "successful_rps": 15.909, "attempted_rps": 16.174, "workload": "one sequential writer and reader, 100ms pause; not a capacity benchmark"}
Container highload-lab3-api-12 Running
Container highload-lab3-api-13 Starting
Container highload-lab3-api-13 Started
Container highload-lab3-api-13 Waiting
Container highload-lab3-api-12 Waiting
Container highload-lab3-api-13 Healthy
Container highload-lab3-api-12 Healthy
PASS: each API replica stopped in turn; reads, writes, sessions and confirmed messages preserved
Полный сохранённый вывод: evidence/criteria/runs/lab3-report-04/failover.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.