forked from mtusi2026/mtusi2026lab6
lab6: базовый коммит из lab5 (0790599)
Перенесено дерево lab5 целиком: NestJS-приложение (API + worker,
RabbitMQ, outbox, S3), Dockerfile, compose.yaml, infra/{haproxy,minio,
rabbitmq}, стендовые скрипты, scripts/lab4, scripts/lab5,
evidence/lab4, evidence/lab5 и contracts/extensions.openapi.json.
Задание lab6 оставлено своим: README, REPORT, COURSE, lab.json,
contracts/{openapi,infrastructure,jobs.schema,attachment-states,
examples,observability}, tests, compose.example.yaml, infra/otel,
.github/pull_request_template.md.
Адаптации при переносе:
- docker-проект mtusi-lab5 -> mtusi-lab6 и тег образа
mtusi-messenger:lab6 (compose.yaml, scripts/stop-one.sh, .env.example,
infra/README.md), чтобы тома и контейнеры не пересекались с lab5;
- Makefile: цели lab5 сохранены целиком (skeleton lab6 не отличается
от skeleton lab5);
- .env.example: переменные приложения и стенда lab5 + блок lab6
(OTEL_*) из skeleton.
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
big_image invariants: {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true}
|
||||
final suite run: peak worker memory: 992.2 MiB / 1280 MiB
|
||||
worker limit: WORKER_MEMORY=1280m, WORKER_CONCURRENCY=2
|
||||
input: two concurrent 8000x5000 PNG, 10 MiB each
|
||||
@@ -0,0 +1,10 @@
|
||||
api Up About a minute (healthy)
|
||||
api Up About a minute (healthy)
|
||||
broker Up 56 minutes (healthy)
|
||||
worker Up About a minute (healthy)
|
||||
user tags
|
||||
messenger [administrator]
|
||||
messenger-worker []
|
||||
user configure write read
|
||||
messenger-worker ^(attachments\.jobs|attachments\.process|attachments\.dlx|attachments\.process\.dlq)$ ^attachments\.(jobs|process|dlx|process\.dlq)$ ^attachments\.(jobs|process|dlx|process\.dlq)$
|
||||
messenger ^(attachments\.jobs|attachments\.process|attachments\.dlx|attachments\.process\.dlq)$ ^attachments\.(jobs|process|dlx|process\.dlq)$ ^attachments\.(jobs|dlx)$
|
||||
@@ -0,0 +1,2 @@
|
||||
consumers after broker restart 1
|
||||
upload after restart ready 3
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
> app@0.0.1 build
|
||||
> nest build
|
||||
|
||||
|
||||
> app@0.0.1 lint
|
||||
> oxlint src/ test/
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
|
||||
mtusi-lab5-api-1 mtusi-messenger:lab5 "docker-entrypoint.s…" api 8 minutes ago Up 2 minutes (healthy) 8080/tcp
|
||||
mtusi-lab5-api-2 mtusi-messenger:lab5 "docker-entrypoint.s…" api 8 minutes ago Up 2 minutes (healthy) 8080/tcp
|
||||
mtusi-lab5-broker-1 rabbitmq:4.1.8-alpine@sha256:153322e3974e6365c50e523e5eadd5a7fae231f0e8c58f67c03bb3e02056e34e "docker-entrypoint.s…" broker 3 hours ago Up 41 seconds (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp
|
||||
mtusi-lab5-haproxy-1 haproxy:3.2-alpine "docker-entrypoint.s…" haproxy 3 hours ago Up 3 minutes 0.0.0.0:8080->8080/tcp, [::]:8080->8080/tcp, 127.0.0.1:8404->8404/tcp
|
||||
mtusi-lab5-postgres-1 postgres:16.4-alpine "docker-entrypoint.s…" postgres 3 hours ago Up 3 minutes (healthy) 127.0.0.1:5432->5432/tcp
|
||||
mtusi-lab5-redis-1 redis:7.4.2-alpine "docker-entrypoint.s…" redis 3 hours ago Up 3 minutes (healthy) 127.0.0.1:6379->6379/tcp
|
||||
mtusi-lab5-s3-1 minio/minio:RELEASE.2025-09-07T16-13-09Z@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e "/usr/bin/docker-ent…" s3 3 hours ago Up 3 minutes (healthy) 127.0.0.1:9000->9000/tcp
|
||||
mtusi-lab5-worker-1 mtusi-messenger:lab5 "docker-entrypoint.s…" worker 8 minutes ago Up About a minute (healthy) 8080/tcp
|
||||
@@ -0,0 +1,4 @@
|
||||
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": 130, "failed_attempts": 0, "first_recovery_seconds": 3.568}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,138 @@
|
||||
[
|
||||
{
|
||||
"name": "crash_after_commit_before_publish",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 29.638,
|
||||
"attachment_id": "9c6d6896-0f76-4d4b-aa37-02b175a40fdc",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "outbox relay published the committed job after API restart"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_side_effect",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 82.618,
|
||||
"attachment_id": "5fb2f6c6-b84d-46b3-ad91-18358faec586",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_commit_before_ack",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 80.048,
|
||||
"attachment_id": "168fb65f-2965-464a-a197-e62af48b25a8",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_commit_before_ack"
|
||||
},
|
||||
{
|
||||
"name": "retry_and_replay",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 84.119,
|
||||
"attachment_id": "98f19c5e-42f2-4ba5-b74f-3fb1831be1ad",
|
||||
"job_attempts": [
|
||||
6
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "transient injected fault exhausted retries; replay recovered"
|
||||
},
|
||||
{
|
||||
"name": "hung_worker",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 88.126,
|
||||
"attachment_id": "00a3eef9-5176-4848-b114-124291f68413",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "hard timeout aborted the hung render and retried"
|
||||
},
|
||||
{
|
||||
"name": "poison",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 36.723,
|
||||
"attachment_id": null,
|
||||
"job_attempts": [],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "malformed messages moved to the DLQ without touching jobs"
|
||||
},
|
||||
{
|
||||
"name": "big_image",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 34.708,
|
||||
"attachment_id": "de5c5405-96d3-40c5-b1c6-6b40f34d7235",
|
||||
"job_attempts": [],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "peak worker memory: 992.2 MiB / 1280 MiB"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,9 @@
|
||||
python3 scripts/lab5/fault_suite.py --base-url "http://localhost:8080" --scenario level4 --output evidence/lab5/faults-level4.json
|
||||
PASS crash_after_commit_before_publish #1 29.638s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} outbox relay published the committed job after API restart
|
||||
PASS crash_after_side_effect #1 82.618s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} crashed at worker.after_side_effect
|
||||
PASS crash_after_commit_before_ack #1 80.048s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} crashed at worker.after_commit_before_ack
|
||||
PASS retry_and_replay #1 84.119s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} transient injected fault exhausted retries; replay recovered
|
||||
PASS hung_worker #1 88.126s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} hard timeout aborted the hung render and retried
|
||||
PASS poison #1 36.723s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} malformed messages moved to the DLQ without touching jobs
|
||||
PASS big_image #1 34.708s {"I1": true, "I2": true, "I3": true, "I4": true, "I5": true, "I6": true} peak worker memory: 992.2 MiB / 1280 MiB
|
||||
7/7 scenarios passed
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,15 @@
|
||||
cd app && E2E_COMPOSE_DIR="/home/tomato/Projects/VP/mtusi2026lab5" E2E_COMPOSE_ENV_FILE=".env" npm run test:dependencies
|
||||
|
||||
> app@0.0.1 test:dependencies
|
||||
> E2E_DEPENDENCY_FAULTS=1 vitest run --config ./vitest.config.e2e.ts dependency-failures
|
||||
|
||||
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
|
||||
|
||||
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab5/app
|
||||
|
||||
|
||||
Test Files 1 passed (1)
|
||||
Tests 7 passed (7)
|
||||
Start at 03:12:54
|
||||
Duration 181.23s (transform 259ms, setup 0ms, import 351ms, tests 180.58s, environment 0ms)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
scripts/app-e2e.sh
|
||||
|
||||
> app@0.0.1 test:e2e
|
||||
> vitest run --config ./vitest.config.e2e.ts
|
||||
|
||||
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
|
||||
|
||||
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab5/app
|
||||
|
||||
|
||||
Test Files 3 passed | 1 skipped (4)
|
||||
Tests 44 passed | 9 skipped (53)
|
||||
Start at 03:16:31
|
||||
Duration 23.23s (transform 2.53s, setup 0ms, import 5.36s, tests 34.68s, environment 1ms)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
python3 tests/smoke.py --base-url "http://localhost:8080"
|
||||
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,3 @@
|
||||
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.
|
||||
@@ -0,0 +1,3 @@
|
||||
{"process":{"messages":0,"consumers":1},"dlq":{"messages":14,"consumers":0}}
|
||||
|
||||
{"attachment":{"id":"b51554bd-cbfc-4e2a-8134-aa9bcc9247c8","status":"ready","error_code":null,"ready_pipeline_version":1,"staging_present":false},"jobs":[{"job_id":"55b4165c-1009-4338-8772-f866fbae2eb9","pipeline_version":1,"status":"succeeded","attempt":1,"max_attempts":5,"last_error_code":null}],"variants":[{"pipeline_version":1,"variant":"thumbnail","sha256":"a18bfc29cd9311807ce56afc7078d45db13b19ac2ac14a31d2b91f2640eddf29","size_bytes":4101,"width":256,"height":160,"object_key":"attachments/b51554bd-cbfc-4e2a-8134-aa9bcc9247c8/v1/thumbnail-a1.jpg","s3":{"exists":true,"etag":"\"1c094bdd7c6cf854d0c4429768fb8c49\"","last_modified":"2026-11-05T00:20:36.000Z"}},{"pipeline_version":1,"variant":"crop","sha256":"06c85b2c7a64a45c5e88d65ef492c3e54bc3a6dd1c4a2fad1dccd71b9aba8113","size_bytes":1657,"width":128,"height":128,"object_key":"attachments/b51554bd-cbfc-4e2a-8134-aa9bcc9247c8/v1/crop-a1.jpg","s3":{"exists":true,"etag":"\"f36ea628d9691b1d7fbad35499d3863f\"","last_modified":"2026-11-05T00:20:36.000Z"}},{"pipeline_version":1,"variant":"optimized","sha256":"0bb5b26524335872b2dfe977e2e364101870bfa4e223f4383ab00c34f6771735","size_bytes":2148,"width":320,"height":200,"object_key":"attachments/b51554bd-cbfc-4e2a-8134-aa9bcc9247c8/v1/optimized-a1.webp","s3":{"exists":true,"etag":"\"03817f0652c967e9a963d9b29a1152c1\"","last_modified":"2026-11-05T00:20:36.000Z"}}],"original":{"exists":true,"etag":"\"c2ab21400d8c13ea847e4d5d3c9832ad\"","last_modified":"2026-11-05T00:20:36.000Z"},"events":[{"job_id":"55b4165c-1009-4338-8772-f866fbae2eb9","event":"created","attempt":1,"detail":{},"created_at":"2026-11-05T00:20:36.743Z"},{"job_id":"55b4165c-1009-4338-8772-f866fbae2eb9","event":"claimed","attempt":1,"detail":{"lease_owner":"c434196d75a8"},"created_at":"2026-11-05T00:20:36.760Z"},{"job_id":"55b4165c-1009-4338-8772-f866fbae2eb9","event":"succeeded","attempt":1,"detail":{},"created_at":"2026-11-05T00:20:36.858Z"},{"job_id":"55b4165c-1009-4338-8772-f866fbae2eb9","event":"staging_deleted","attempt":1,"detail":{"staging_key":"staging/b51554bd-cbfc-4e2a-8134-aa9bcc9247c8/original"},"created_at":"2026-11-05T00:20:36.866Z"}],"outbox":{"pending":0,"published":1}}
|
||||
@@ -0,0 +1,3 @@
|
||||
attachment 431a2dbd-c2aa-4130-8866-6e1895f154d1 status ready ready_seconds 5.1
|
||||
events ['created', 'reconciled', 'claimed', 'succeeded', 'staging_deleted']
|
||||
reconciled True
|
||||
@@ -0,0 +1,44 @@
|
||||
# lab5 — сводка доказательств
|
||||
|
||||
Дата прогона: 2026-11-05. Хост: 8 vCPU i7-11370H, 15 GiB RAM; Docker 29.9.2,
|
||||
Node 25.7.0, Python 3.14.8. Все команды выполнены из корня репозитория; секреты
|
||||
и токены не печатались.
|
||||
|
||||
| Критерий | Файл | Наблюдение |
|
||||
| --- | --- | --- |
|
||||
| Offline-структура и OpenAPI | `make-check.txt` | `PASS: offline skeleton structure` |
|
||||
| Публичный smoke (уровень 3) | `make-test.txt` | `PASS: lab5 public API scenario`; 202 → ready → thumbnail 256×160 JPEG |
|
||||
| Юнит-тесты | `unit-tests.txt` | 18 файлов, 70 тестов, все зелёные; включены fit-inside, backoff, job-message, classifyError, pipelines (EXIF, alpha, determinism) |
|
||||
| E2E приложения | `make-test-e2e.txt` | 44 passed, 9 skipped (opt-in dependency сценарии) |
|
||||
| Отказы зависимостей | `make-test-dependencies.txt` | 7/7: Redis, PostgreSQL, per-replica DB path, насыщение пула, S3 stop/pause, staging при PG down |
|
||||
| Сохранность после рестарта stores | `persistence.txt` | `PASS: persistence preserved confirmed data and existing session` |
|
||||
| Failover API-реплики | `failover.txt` | 130 успешных записей, 0 ошибок, первое восстановление 3.568 s, 2 инстанса до отказа |
|
||||
| Демонстрация «worker остановлен» | `worker-down-demo.txt` | 202 queued, content 409, сообщение привязано, очередь пережила restart broker+API, после start worker — ready и thumbnail 256×160 |
|
||||
| Уровень 4, fault injection | `faults-level4.json`, `faults-level4.txt` | 7/7 сценариев, все I1–I6; crash COMMIT→publish, retry/replay, timeout, DLQ, big image |
|
||||
| Трек 2, 3 повтора | `track2.json`, `track2.txt` | 21/21 (7 сценариев × 3), все I1–I6; duplicate, reorder, crash до/после side effect, crash после COMMIT до ack, relay crash, stale version |
|
||||
| Память worker на 40 Мп | `big-image-memory.txt` | 2 × 8000×5000 одновременно; пик 992.2 MiB в финальном прогоне (934–966 MiB в предыдущих) при лимите 1280 MiB; `OOMKilled=false` |
|
||||
| Восстановление потерянного сообщения | `reconciler.txt` | сообщение удалено из очереди после publish; reconciler переотправил, attachment ready за 5.1 s, событие `reconciled` |
|
||||
| Resubscribe после рестарта broker | `broker-resubscribe.txt` | после restart broker consumer вернулся, следующий upload дошёл до ready с 3 вариантами |
|
||||
| Разделение RabbitMQ identities | `broker-identities.txt` | `messenger` и `messenger-worker`; API читает только обменники, worker — очередь; оба ограничены четырьмя ресурсами топологии |
|
||||
| Состав стенда | `compose-ps.txt` | api ×2 healthy, worker healthy, broker healthy, postgres/redis/s3 healthy |
|
||||
| Очереди и job после demo | `queues.txt` | process 0/1 consumer, DLQ 12 (накопленные poison-сообщения); job succeeded attempt 1, `staging_present=false` |
|
||||
|
||||
## Параметры fault-стенда
|
||||
|
||||
```sh
|
||||
FAULT_INJECTION_ENABLED=1 JOB_TIMEOUT_SECONDS=10 JOB_LEASE_SECONDS=8 \
|
||||
JOB_RETRY_BASE_MS=500 JOB_RETRY_MAX_MS=4000 make stand-up
|
||||
```
|
||||
|
||||
`WORKER_CONCURRENCY=2`, `JOB_MAX_ATTEMPTS=5`, `WORKER_MEMORY=1280m`.
|
||||
После экспериментов стенд возвращён в штатный режим
|
||||
(`FAULT_INJECTION_ENABLED=0`, timeout 60 s, lease 30 s) и `make test` повторён.
|
||||
|
||||
## Итог трека 2
|
||||
|
||||
`track2.json`: 21 запуск, 21 passed. Средние длительности: duplicate 16.7 s,
|
||||
reorder 36.7 s, crash_before 42.1 s, crash_after 43.9 s, crash_after_ack
|
||||
33.2 s, relay_crash 42.1 s, stale_version 48.8 s. Ни один инвариант I1–I6 не
|
||||
нарушен. Повторные публикации и redelivery наблюдались и поглощались
|
||||
(`duplicate_skipped`), S3 etag вариантов не менялся; v1 после v2 получил
|
||||
`superseded`, а v2-объекты остались нетронутыми.
|
||||
@@ -0,0 +1,425 @@
|
||||
[
|
||||
{
|
||||
"name": "duplicate",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 32.0,
|
||||
"attachment_id": "5935c541-99c8-4870-ac4c-0b56fa0d1695",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "5 duplicate deliveries were absorbed by the DB fence"
|
||||
},
|
||||
{
|
||||
"name": "duplicate",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 29.828,
|
||||
"attachment_id": "479b209f-da35-4f5f-9f63-e69687219640",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "5 duplicate deliveries were absorbed by the DB fence"
|
||||
},
|
||||
{
|
||||
"name": "duplicate",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 31.497,
|
||||
"attachment_id": "ae5a273e-46b5-47b5-8b95-31bcba873522",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "5 duplicate deliveries were absorbed by the DB fence"
|
||||
},
|
||||
{
|
||||
"name": "reorder",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 74.003,
|
||||
"attachment_id": "e6cb0d4f-d3b8-4cad-be1d-0b082f772d32",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "attempt 99 and a duplicate attempt 1 were acked as skips"
|
||||
},
|
||||
{
|
||||
"name": "reorder",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 81.88,
|
||||
"attachment_id": "b8e17ee2-316c-4d47-852a-eb954438e951",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "attempt 99 and a duplicate attempt 1 were acked as skips"
|
||||
},
|
||||
{
|
||||
"name": "reorder",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 76.46,
|
||||
"attachment_id": "3ecaef19-fca6-468e-ad6c-b6ec89f16fd2",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "attempt 99 and a duplicate attempt 1 were acked as skips"
|
||||
},
|
||||
{
|
||||
"name": "crash_before_side_effect",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 84.929,
|
||||
"attachment_id": "f796e4ef-e4f7-4980-9969-2d7af7f8173f",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.before_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_before_side_effect",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 82.228,
|
||||
"attachment_id": "dff97faf-a729-4c82-ac96-8580aff44606",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.before_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_before_side_effect",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 82.816,
|
||||
"attachment_id": "2f187d8a-3d12-4f9e-af10-b94ad87bca31",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.before_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_side_effect",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 83.342,
|
||||
"attachment_id": "20a45ae3-6f74-4547-bb76-f44c0c35fdd5",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_side_effect",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 82.109,
|
||||
"attachment_id": "42b41254-417d-41a8-b8ea-5836dc4dbcff",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_side_effect",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 81.735,
|
||||
"attachment_id": "beaad33b-5f44-452c-bf4e-d2577b248cfb",
|
||||
"job_attempts": [
|
||||
2
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_side_effect"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_commit_before_ack",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 74.213,
|
||||
"attachment_id": "c01dd235-7257-48f4-85c2-d6025d85a09e",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_commit_before_ack"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_commit_before_ack",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 70.885,
|
||||
"attachment_id": "d165ea80-ed1c-4d96-9246-0c637a19b191",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_commit_before_ack"
|
||||
},
|
||||
{
|
||||
"name": "crash_after_commit_before_ack",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 74.808,
|
||||
"attachment_id": "15414a8c-0230-40be-97b4-8bcbee990147",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "crashed at worker.after_commit_before_ack"
|
||||
},
|
||||
{
|
||||
"name": "relay_crash_after_publish",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 84.973,
|
||||
"attachment_id": "cbc4a105-9966-4ff4-906e-f8cafbb4c58b",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "relay republished the same message; duplicate absorbed"
|
||||
},
|
||||
{
|
||||
"name": "relay_crash_after_publish",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 83.561,
|
||||
"attachment_id": "8607c972-a90b-45d4-b5ce-05ba3f201b31",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "relay republished the same message; duplicate absorbed"
|
||||
},
|
||||
{
|
||||
"name": "relay_crash_after_publish",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 83.425,
|
||||
"attachment_id": "7119cbcd-cc68-4b5d-ae94-3ac9b2cd9869",
|
||||
"job_attempts": [
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "relay republished the same message; duplicate absorbed"
|
||||
},
|
||||
{
|
||||
"name": "stale_version",
|
||||
"repeat": 1,
|
||||
"passed": true,
|
||||
"duration_s": 89.723,
|
||||
"attachment_id": "495ff6af-c20d-485e-9294-fa0fe835d9df",
|
||||
"job_attempts": [
|
||||
1,
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "v1 finished after v2 and was recorded as superseded"
|
||||
},
|
||||
{
|
||||
"name": "stale_version",
|
||||
"repeat": 2,
|
||||
"passed": true,
|
||||
"duration_s": 90.277,
|
||||
"attachment_id": "d1a7eb56-5b9d-4631-b61e-45e642c9c247",
|
||||
"job_attempts": [
|
||||
1,
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "v1 finished after v2 and was recorded as superseded"
|
||||
},
|
||||
{
|
||||
"name": "stale_version",
|
||||
"repeat": 3,
|
||||
"passed": true,
|
||||
"duration_s": 86.614,
|
||||
"attachment_id": "4f3f0abe-86b0-43bb-a49e-8a9dd93015b4",
|
||||
"job_attempts": [
|
||||
1,
|
||||
1
|
||||
],
|
||||
"events_summary": {},
|
||||
"invariants": {
|
||||
"I1": true,
|
||||
"I2": true,
|
||||
"I3": true,
|
||||
"I4": true,
|
||||
"I5": true,
|
||||
"I6": true
|
||||
},
|
||||
"notes": "v1 finished after v2 and was recorded as superseded"
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
track2: 21/21 scenarios passed
|
||||
PASS duplicate #1 32.000s I1=true I2=true I3=true I4=true I5=true I6=true 5 duplicate deliveries were absorbed by the DB fence
|
||||
PASS duplicate #2 29.828s I1=true I2=true I3=true I4=true I5=true I6=true 5 duplicate deliveries were absorbed by the DB fence
|
||||
PASS duplicate #3 31.497s I1=true I2=true I3=true I4=true I5=true I6=true 5 duplicate deliveries were absorbed by the DB fence
|
||||
PASS reorder #1 74.003s I1=true I2=true I3=true I4=true I5=true I6=true attempt 99 and a duplicate attempt 1 were acked as skips
|
||||
PASS reorder #2 81.880s I1=true I2=true I3=true I4=true I5=true I6=true attempt 99 and a duplicate attempt 1 were acked as skips
|
||||
PASS reorder #3 76.460s I1=true I2=true I3=true I4=true I5=true I6=true attempt 99 and a duplicate attempt 1 were acked as skips
|
||||
PASS crash_before_side_effect #1 84.929s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.before_side_effect
|
||||
PASS crash_before_side_effect #2 82.228s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.before_side_effect
|
||||
PASS crash_before_side_effect #3 82.816s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.before_side_effect
|
||||
PASS crash_after_side_effect #1 83.342s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.after_side_effect
|
||||
PASS crash_after_side_effect #2 82.109s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.after_side_effect
|
||||
PASS crash_after_side_effect #3 81.735s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.after_side_effect
|
||||
PASS crash_after_commit_before_ack #1 74.213s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.after_commit_before_ack
|
||||
PASS crash_after_commit_before_ack #2 70.885s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.after_commit_before_ack
|
||||
PASS crash_after_commit_before_ack #3 74.808s I1=true I2=true I3=true I4=true I5=true I6=true crashed at worker.after_commit_before_ack
|
||||
PASS relay_crash_after_publish #1 84.973s I1=true I2=true I3=true I4=true I5=true I6=true relay republished the same message; duplicate absorbed
|
||||
PASS relay_crash_after_publish #2 83.561s I1=true I2=true I3=true I4=true I5=true I6=true relay republished the same message; duplicate absorbed
|
||||
PASS relay_crash_after_publish #3 83.425s I1=true I2=true I3=true I4=true I5=true I6=true relay republished the same message; duplicate absorbed
|
||||
PASS stale_version #1 89.723s I1=true I2=true I3=true I4=true I5=true I6=true v1 finished after v2 and was recorded as superseded
|
||||
PASS stale_version #2 90.277s I1=true I2=true I3=true I4=true I5=true I6=true v1 finished after v2 and was recorded as superseded
|
||||
PASS stale_version #3 86.614s I1=true I2=true I3=true I4=true I5=true I6=true v1 finished after v2 and was recorded as superseded
|
||||
@@ -0,0 +1,17 @@
|
||||
|
||||
> app@0.0.1 test:unit
|
||||
> vitest run src/
|
||||
|
||||
The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
|
||||
|
||||
RUN v4.1.11 /home/tomato/Projects/VP/mtusi2026lab5/app
|
||||
|
||||
[Nest] 2892631 - 11/05/2026, 3:16:19 AM WARN [MessagesCacheService] Cache read failed, serving PostgreSQL: redis down
|
||||
[Nest] 2892631 - 11/05/2026, 3:16:19 AM WARN [MessagesCacheService] Cache fill failed: redis down
|
||||
[Nest] 2893013 - 11/05/2026, 3:16:27 AM WARN [AttachmentsService] Compensation of attachment 7f67f209-53ca-4786-b06e-23c31ac0b59b deferred: Connection terminated unexpectedly
|
||||
|
||||
Test Files 18 passed (18)
|
||||
Tests 70 passed (70)
|
||||
Start at 03:16:17
|
||||
Duration 11.09s (transform 2.70s, setup 0ms, import 32.94s, tests 8.26s, environment 18ms)
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
python3 scripts/lab5/worker_down_demo.py --base-url "http://localhost:8080"
|
||||
[1] compose ps
|
||||
SERVICE STATUS
|
||||
api Up 41 seconds (healthy)
|
||||
api Up 2 seconds (health: starting)
|
||||
broker Up 44 seconds (healthy)
|
||||
haproxy Up 45 seconds
|
||||
postgres Up 45 seconds (healthy)
|
||||
redis Up 45 seconds (healthy)
|
||||
s3 Up 46 seconds (healthy)
|
||||
worker Up 45 seconds (healthy)
|
||||
[2] stop worker
|
||||
[3] upload while worker is down (expect 202 queued)
|
||||
attachment=ddc95667-82f9-49ed-a7d9-031ae46fb4f8 status=queued
|
||||
[4] content and thumbnail must answer 409 before ready
|
||||
[5] link the queued attachment to messages
|
||||
message=13caa29b-26bd-49e6-8534-1a078df9a901
|
||||
[6] wait for outbox publish and a message in the queue
|
||||
queue={'messages': 1, 'type': 'quorum'}
|
||||
[7] restart broker and API with volumes
|
||||
[8] the quorum message survived the broker restart
|
||||
queue={'messages': 1, 'type': 'quorum'}
|
||||
[9] start worker
|
||||
[10] wait ready and verify the thumbnail
|
||||
ready attachment=ddc95667-82f9-49ed-a7d9-031ae46fb4f8 thumbnail=256x160 sha256=a18bfc29cd931180...
|
||||
[11] compose ps
|
||||
SERVICE STATUS
|
||||
api Up 43 seconds (healthy)
|
||||
api Up 43 seconds (healthy)
|
||||
broker Up 45 seconds (healthy)
|
||||
haproxy Up About a minute
|
||||
postgres Up About a minute (healthy)
|
||||
redis Up About a minute (healthy)
|
||||
s3 Up About a minute (healthy)
|
||||
worker Up 2 seconds (health: starting)
|
||||
PASS: worker-down durability demo
|
||||
Reference in New Issue
Block a user