lab5: очереди и асинхронная обработка изображений

Durable staging handoff, transactional outbox, at-least-once worker with lease fencing, idempotent versioned pipeline, three variants, operator tooling, contract tests and evidence. Includes the review fixes: reprocess source selection and failure settlement, replay guards, stale-job retirement, PNG structural/raster validation, migration rollback safety and audit events.
This commit is contained in:
Vladislav Kunetskiy
2026-10-31 14:34:24 +03:00
parent 6c5ba026f1
commit 01b885e846
99 changed files with 10164 additions and 1452 deletions
+20
View File
@@ -0,0 +1,20 @@
# Lab5 evidence
All artifacts were produced against the local Compose stand on 2026-10-30
(2 vCPU, 2 GiB Docker VM, RabbitMQ 4.3.7, PostgreSQL 18, SeaweedFS 3.80).
- `stand.txt` — containers, image versions, VM limits.
- `smoke.txt` — public `make test`.
- `async.txt` — worker down/restart, broker restart with volume, stack restart.
- `variants.txt` — thumbnail/crop/optimized metadata, bytes, dimensions.
- `faults.txt` — permanent/transient retry, DLQ/replay, crash before/after
side effect, crash before/after ack, outbox gap, lease takeover.
- `persistence.txt`, `failover.txt`, `idempotency.txt`, `lb-readiness.txt` —
cumulative lab2–lab4 regressions.
- `track2/run.txt`, `track2/runs.csv`, `track2/summary.md` — track 2
duplicate/stale/version harness (3 repetitions).
- `unit-test.txt`, `integration-test.txt`, `vet.txt`, `lint.txt`,
`validate.txt` — build/quality gates.
No `.env`, tokens, credentials or presigned URLs are stored here. Raw SQL rows
contain only synthetic IDs and metadata.
+12
View File
@@ -0,0 +1,12 @@
# make test-queue 2026-10-31T11:26:40Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/lab5_async.py --base-url "http://localhost:8080"
worker down: 202 queued, content 409, queued attachment linked, API restarted
worker restarted: ready, thumbnail and original downloadable, staging cleared
broker down: upload accepted into outbox
broker + relay recovered: queued job reached ready
stack restart: ready attachment and original preserved
worker down: reprocess pipeline 2 accepted, v1 audit event recorded, upload still queued
worker up: reprocessed upload reached ready at pipeline 2, v1 superseded
worker down: reprocess pipeline 3 refused, v1 job untouched
worker up: preserved upload reached ready at pipeline 1
PASS: lab5 async worker/broker durability
+25
View File
@@ -0,0 +1,25 @@
# make test-attachments 2026-10-31T11:26:14Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/attachments_negative.py --base-url "http://localhost:8080"
10 MiB + 1 body: 413
empty body: 415
corrupt PNG (IDAT CRC): 415
MIME spoof (PNG declared as JPEG): 415
structurally valid PNG with non-zlib IDAT: 415
valid zlib, empty PNG raster: 415
valid zlib, invalid PNG scanline filter: 415
invalid PNG color type/bit depth pair: 415
duplicate PNG IHDR: 415
trailing bytes after PNG zlib stream: 415
tRNS on RGBA PNG: 415
short tRNS on RGB PNG: 415
PLTE entries exceed palette bit depth: 415
palette tRNS exceeds PLTE entries: 415
dangerous filenames: 400
foreign attachment metadata/content: 404
empty text without attachments: 400
attachment from another chat: 404
11 attachment ids: 400
duplicate attachment ids: 400
attachment-only message: 201
anonymous direct S3 GET: 403
PASS: lab4 attachment negative scenarios
+29
View File
@@ -0,0 +1,29 @@
# db state 2026-10-30T20:16:08Z
status | count
---------+-------
failed | 2
pending | 4
ready | 31
(3 rows)
status | count
--------+-------
failed | 2
ready | 34
(2 rows)
variants
----------
102
(1 row)
unpublished | outbox
-------------+--------
0 | 58
(1 row)
Timeout: 60.0 seconds ...
Listing queues for vhost messenger ...
name messages messages_ready messages_unacknowledged consumers
attachment.process.dead 4 4 0 0
attachment.process.v1 0 0 0 0
+5
View File
@@ -0,0 +1,5 @@
# failover 2026-10-30T20:11:43Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 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": 99, "failed_attempts": 0, "first_recovery_seconds": 0.221}
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
+15
View File
@@ -0,0 +1,15 @@
# make test-faults 2026-10-31T11:27:03Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/lab5_faults.py --base-url "http://localhost:8080"
permanent failure: failed/injected_failure, content 409, failed attachment not linkable, registry visible
replay: failed -> queued -> ready, one thumbnail
replay ready job: refused
replay older failed version while v2 queued: refused, state intact
v2 published after older replay refusal
replay of failed reprocess: queued projection restored, then ready at pipeline 2
transient exhaustion: attempts=5, retry_exhausted, four retries, DLQ message present
crash after first variant: redelivered, same three variants, attempts=2
crash after commit before ack: ready remains, redelivery is a no-op
crash after claim before side effect: requeued, attempts=2, ready
outbox gap: crash before publish recovered through the relay, outbox published, ready
lease expiry: paused worker, reaper requeued, stale attempt fenced, ready
PASS: lab5 level 4 fault injection
+4
View File
@@ -0,0 +1,4 @@
# idempotency 2026-10-30T20:11:43Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/idempotency_parallel.py --base-url "http://localhost:8080"
{"replay": {"workers": 12, "instances": ["1c67613c89f2", "ee96975adb44"], "message_id": "01a18e70-8fcd-7519-91ab-d9c43b6a5f37"}, "conflict": {"workers": 12, "accepted": 1, "conflicts": 11}, "stable_body": {"message_id": "01a18e70-8ff9-759f-ab87-abd58f58c59d"}, "key_required": {"status": 400}}
PASS: параллельный повтор с одним Idempotency-Key создаёт ровно одно сообщение
+2
View File
@@ -0,0 +1,2 @@
ok mtusi-messenger/internal/storage/postgres 9.448s
ok mtusi-messenger/internal/storage/redis 1.238s
+31
View File
@@ -0,0 +1,31 @@
# LB excludes a not-ready but reachable replica (lab5)
# generated: 2026-10-30T20:18:32Z
# lb: haproxy:3.2-alpine@sha256:254e6370f01cd654e0744edf607c67f33777c1b6a9dc0d4b28bcba7171460122
## 1. baseline: requests through LB by replica
22 23d07355bd77
18 56bd7451c245
stats: api1=UP api2=MAINT (resolution) api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 2. start a temporary TCP proxy to postgres and a candidate replica behind the same network alias
instance-id: 42c73eb4c0a5, readiness while its database is reachable: 200
load balancer slot for the candidate: api2, stats: api1=UP api2=UP 1/2 api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 3. cut the candidate's database access (stop only the TCP proxy)
candidate is still running: running, readiness: 503
waiting for the load balancer to mark api2 DOWN
api2 went DOWN 1s after its database was cut (check: inter 2s fall 2)
stats after failure: api1=UP api2=DOWN api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 4. 40 requests through LB while the candidate is not ready
22 23d07355bd77
18 56bd7451c245
(the candidate must not appear above)
## 5. business writes through LB during the exclusion
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 816.58,
## 6. cleanup
stats after cleanup: api1=UP api2=MAINT (resolution) api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
+34
View File
@@ -0,0 +1,34 @@
# lb readiness 2026-10-30T20:18:31Z
scripts/lb_readiness_check.sh
# LB excludes a not-ready but reachable replica (lab5)
# generated: 2026-10-30T20:18:32Z
# lb: haproxy:3.2-alpine@sha256:254e6370f01cd654e0744edf607c67f33777c1b6a9dc0d4b28bcba7171460122
## 1. baseline: requests through LB by replica
22 23d07355bd77
18 56bd7451c245
stats: api1=UP api2=MAINT (resolution) api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 2. start a temporary TCP proxy to postgres and a candidate replica behind the same network alias
instance-id: 42c73eb4c0a5, readiness while its database is reachable: 200
load balancer slot for the candidate: api2, stats: api1=UP api2=UP 1/2 api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 3. cut the candidate's database access (stop only the TCP proxy)
candidate is still running: running, readiness: 503
waiting for the load balancer to mark api2 DOWN
api2 went DOWN 1s after its database was cut (check: inter 2s fall 2)
stats after failure: api1=UP api2=DOWN api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 4. 40 requests through LB while the candidate is not ready
22 23d07355bd77
18 56bd7451c245
(the candidate must not appear above)
## 5. business writes through LB during the exclusion
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 816.58,
## 6. cleanup
stats after cleanup: api1=UP api2=MAINT (resolution) api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
lb_readiness_check.sh: evidence in evidence/lab5/lb-readiness-detail.txt
+20
View File
@@ -0,0 +1,20 @@
/Users/vladislav/Projects/mtusi2026lab5/bin/golangci-lint run -v
level=info msg="golangci-lint has version 2.13.2 built with go1.27.1 from (unknown, modified: ?, mod sum: \"h1:bCyq3E4vo9qwzifjpzJqYndEt7Ncva80qkk8G2B4TXU=\") on (unknown)"
level=info msg="[config_reader] Config search paths: [./ /Users/vladislav/Projects/mtusi2026lab5 /Users/vladislav/Projects /Users/vladislav /Users /]"
level=info msg="[config_reader] Used config file .golangci.yml"
level=info msg="[config_reader] Module name \"mtusi-messenger\""
level=info msg="[goenv] Read go env for 6.264542ms: map[string]string{\"GOCACHE\":\"/Users/vladislav/Library/Caches/go-build\", \"GOROOT\":\"/opt/homebrew/Cellar/go/1.27.1/libexec\"}"
level=info msg="[lintersdb] Active 50 linters: [asasalint bodyclose canonicalheader containedctx contextcheck copyloopvar depguard durationcheck errcheck errname errorlint exhaustive exptostd fatcontext forbidigo forcetypeassert gocheckcompilerdirectives gocritic gofumpt goimports gomoddirectives gosec govet ineffassign intrange makezero misspell musttag nilerr nilnil noctx nolintlint perfsprint prealloc reassign recvcheck revive rowserrcheck sloglint sqlclosecheck staticcheck testifylint thelper tparallel unconvert unparam unused usestdlibvars usetesting wastedassign]"
level=info msg="[loader] Using build tags: [integration]"
level=info msg="[loader] Go packages loading at mode 8767 (compiled_files|deps|exports_file|files|types_sizes|imports|name) took 193.808375ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 11.667ms"
level=info msg="[linters_context/goanalysis] analyzers took 0s with no stages"
level=info msg="[runner/exclusion_rules] Skipped 14 issues by rules: [Path: \"_test\\\\.go\", Linters: \"gosec, prealloc, forcetypeassert, unparam\"]"
level=info msg="[runner] Issues before processing: 887, after processing: 0"
level=info msg="[runner] Processors filtering stat (in/out): path_absoluter: 887/887, cgo: 887/887, filename_unadjuster: 887/887, nolint_filter: 6/0, invalid_issue: 887/887, exclusion_paths: 887/887, path_relativity: 887/887, generated_file_filter: 887/298, exclusion_rules: 298/6"
level=info msg="[runner] processing took 2.828168ms with stages: generated_file_filter: 1.490334ms, nolint_filter: 764.209µs, path_relativity: 284.917µs, exclusion_rules: 251.001µs, invalid_issue: 13.417µs, cgo: 12.25µs, path_absoluter: 4.666µs, sort_results: 2.916µs, filename_unadjuster: 2.542µs, max_same_issues: 874ns, diff: 167ns, fixer: 166ns, path_prettifier: 125ns, max_per_file_from_linter: 125ns, exclusion_paths: 125ns, path_shortener: 124ns, uniq_by_line: 84ns, severity-rules: 42ns, max_from_linter: 42ns, source_code: 42ns"
level=info msg="[runner] linters took 629.148708ms with stages: goanalysis_metalinter: 626.277292ms"
0 issues.
level=info msg="File cache stats: 0 entries of total size 0B"
level=info msg="Memory: 10 samples, avg is 87.2MB, max is 111.5MB"
level=info msg="Execution took 841.622625ms"
+4
View File
@@ -0,0 +1,4 @@
# persistence 2026-10-30T20:12:05Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 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.
+11
View File
@@ -0,0 +1,11 @@
# presign 2026-10-30T20:11:41Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 student-tests/presign_flow.py --base-url "http://localhost:8080"
happy path: direct PUT 200, complete queued, ready after worker
message with attachment downloaded as the second chat member
repeated complete is idempotent
foreign complete: 404
complete before PUT: 409
wrong completion checksum: 409
oversized direct PUT: 403 from S3; complete: 409 (nothing stored)
same-size overwrite: last PUT wins, checksum verified
PASS: lab4 presigned upload flow
+3
View File
@@ -0,0 +1,3 @@
# make test 2026-10-31T11:26:59Z
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy NO_PROXY=localhost,127.0.0.1,::1 no_proxy=localhost,127.0.0.1,::1 python3 tests/smoke.py --base-url "http://localhost:8080"
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
+20
View File
@@ -0,0 +1,20 @@
# stand 2026-10-30T20:16:07Z
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi-messenger-lab5-api-1 mtusi-messenger:lab5 "/usr/local/bin/mess…" api 42 seconds ago Up Less than a second (health: starting) 8080/tcp
mtusi-messenger-lab5-api-2 mtusi-messenger:lab5 "/usr/local/bin/mess…" api 42 seconds ago Up Less than a second (health: starting) 8080/tcp
mtusi-messenger-lab5-broker-1 rabbitmq:4.3.7-management-alpine@sha256:1528a88eebf2bc4d0ab7e9d5d9bc542e9bdf5e1b105e65848fcf8de5c2186528 "docker-entrypoint.s…" broker 8 minutes ago Up 8 seconds (healthy) 4369/tcp, 5671-5672/tcp, 15671/tcp, 15691-15692/tcp, 25672/tcp, 127.0.0.1:15672->15672/tcp
mtusi-messenger-lab5-lb-1 haproxy:3.2-alpine@sha256:254e6370f01cd654e0744edf607c67f33777c1b6a9dc0d4b28bcba7171460122 "docker-entrypoint.s…" lb 8 minutes ago Up 3 minutes 127.0.0.1:8404->8404/tcp, 127.0.0.1:8080->80/tcp
mtusi-messenger-lab5-postgres-1 postgres:18-alpine@sha256:77f585114c32fbca283dc835b0596f4e52b51b4c6662d7810b2f4084f60a1873 "docker-entrypoint.s…" postgres 8 minutes ago Up 3 minutes (healthy) 5432/tcp
mtusi-messenger-lab5-redis-1 redis:7.4-alpine@sha256:858f009f9709ce576febc734aa78b8f6d624b82571f9ddb6bda4377c833b3499 "docker-entrypoint.s…" redis 8 minutes ago Up 4 minutes (healthy) 6379/tcp
mtusi-messenger-lab5-relay-1 mtusi-messenger:lab5 "/usr/local/bin/relay" relay 42 seconds ago Up Less than a second (health: starting) 8080/tcp, 127.0.0.1:8082->8082/tcp
mtusi-messenger-lab5-seaweedfs-1 chrislusf/seaweedfs:3.80@sha256:1055999e08eed1789b0ae45d235126e4495e23d3fb9d6396293fd42539b1ae6a "/entrypoint.sh serv…" seaweedfs 8 minutes ago Up 3 minutes (healthy) 7333/tcp, 8080/tcp, 8888/tcp, 9333/tcp, 18080/tcp, 18888/tcp, 19333/tcp, 127.0.0.1:8333->8333/tcp
mtusi-messenger-lab5-worker-1 mtusi-messenger:lab5 "/usr/local/bin/work…" worker 42 seconds ago Up Less than a second (health: starting) 8080/tcp, 127.0.0.1:8081->8081/tcp
mtusi-messenger:lab5 10b83ff52c7d
rabbitmq:4.3.7-management-alpine 1528a88eebf2
haproxy:3.2-alpine 254e6370f01c
redis:7.4-alpine 858f009f9709
postgres:18-alpine 77f585114c32
chrislusf/seaweedfs:3.80 1055999e08ee
CPUs=2 MemTotal=2053644288
+7
View File
@@ -0,0 +1,7 @@
Dduplicate_before_effect rep=1: PASS
Dstale_version_after_v2 rep=1: PASS
Dduplicate_before_effect rep=2: PASS
Dstale_version_after_v2 rep=2: PASS
Dduplicate_before_effect rep=3: PASS
Dstale_version_after_v2 rep=3: PASS
PASS: track2 6/6 scenarios
+7
View File
@@ -0,0 +1,7 @@
scenario,rep,pass,detail
duplicate_before_effect,1,1,attempts=1
stale_version_after_v2,1,1,v1_job=01a18e6e-17b0-763b-b330-7adbcb43a700
duplicate_before_effect,2,1,attempts=1
stale_version_after_v2,2,1,v1_job=01a18e6e-455e-75f3-857a-750ed660378b
duplicate_before_effect,3,1,attempts=1
stale_version_after_v2,3,1,v1_job=01a18e6e-74f2-7b4a-842b-c014c626413c
1 scenario rep pass detail
2 duplicate_before_effect 1 1 attempts=1
3 stale_version_after_v2 1 1 v1_job=01a18e6e-17b0-763b-b330-7adbcb43a700
4 duplicate_before_effect 2 1 attempts=1
5 stale_version_after_v2 2 1 v1_job=01a18e6e-455e-75f3-857a-750ed660378b
6 duplicate_before_effect 3 1 attempts=1
7 stale_version_after_v2 3 1 v1_job=01a18e6e-74f2-7b4a-842b-c014c626413c
+21
View File
@@ -0,0 +1,21 @@
# Track 2 — versioned pipeline and duplicate/stale delivery
Hypothesis: with the effect key `(attachment_id, pipeline_version, variant)`,
deterministic object keys, a serving version that changes only when all v2
variants are committed, and stale-version acknowledgements, an at-least-once
pipeline loses no accepted work and never overwrites a newer result with an
older duplicate.
Method: N=3 repetitions. Each repetition creates fresh users/chat and runs:
- duplicate pipeline publication while the worker is stopped, followed by recovery;
- v1 ready -> explicit reprocess to v2 -> old v1 message delivered after v2 ready.
Invariants checked: unique variant rows per effect key; ready remains ready;
serving pipeline version never regresses; original bytes/checksum unchanged;
stale job state is not rewritten.
Limitations: this harness covers duplicate and stale/reorder delivery. Crash
windows (before/after side effect, before/after ack, outbox gap) and lease
takeover are covered by student-tests/lab5_faults.py; both are single-node
Compose evidence, not a production availability claim. Delivery is
at-least-once; exactly-once is not claimed.
+41
View File
@@ -0,0 +1,41 @@
env -u APP_ENV -u SERVER_HOST -u SERVER_PORT -u SERVER_READ_HEADER_TIMEOUT -u SERVER_READ_TIMEOUT -u SERVER_SHUTDOWN_TIMEOUT -u SERVER_MAX_BODY_BYTES -u LOG_LEVEL -u LOG_FORMAT -u POSTGRES_HOST -u POSTGRES_PORT -u POSTGRES_DATABASE -u POSTGRES_USER -u POSTGRES_PASSWORD -u POSTGRES_SSL_MODE -u POSTGRES_MAX_CONNS -u POSTGRES_MIN_CONNS -u POSTGRES_MAX_CONN_LIFETIME -u POSTGRES_MAX_CONN_IDLE_TIME -u POSTGRES_CONNECT_TIMEOUT -u POSTGRES_QUERY_TIMEOUT -u REDIS_ENABLED -u REDIS_HOST -u REDIS_PORT -u REDIS_PASSWORD -u REDIS_DB -u REDIS_MAX_RETRIES -u REDIS_DIAL_TIMEOUT -u REDIS_READ_TIMEOUT -u REDIS_WRITE_TIMEOUT -u REDIS_POOL_SIZE -u CACHE_ENABLED -u CACHE_CHAT_LIST_TTL -u CACHE_LOCK_TTL -u CACHE_LOCK_WAIT_TIMEOUT -u SESSION_TTL_SECONDS -u IDEMPOTENCY_TTL_SECONDS -u API_REPLICAS -u API_CPU_LIMIT -u API_MEM_LIMIT -u POSTGRES_MAX_CONNS -u POSTGRES_CPU_LIMIT -u POSTGRES_MEM_LIMIT -u LB_STATS_PORT -u S3_ENDPOINT -u S3_PUBLIC_ENDPOINT -u S3_PORT -u S3_REGION -u S3_BUCKET -u S3_ACCESS_KEY_ID -u S3_SECRET_ACCESS_KEY -u MAX_UPLOAD_BYTES -u MAX_IMAGE_PIXELS -u S3_PRESIGN_TTL -u S3_SWEEP_INTERVAL -u S3_SWEEP_GRACE -u BROKER_USER -u BROKER_PASSWORD -u BROKER_VHOST -u BROKER_URL -u BROKER_EXCHANGE -u BROKER_QUEUE -u BROKER_DLX -u BROKER_DLQ -u BROKER_MANAGEMENT_PORT -u BROKER_CPU_LIMIT -u BROKER_MEM_LIMIT -u WORKER_CONCURRENCY -u WORKER_PREFETCH -u WORKER_CPU_LIMIT -u WORKER_MEM_LIMIT -u WORKER_SHUTDOWN_TIMEOUT -u PROCESSING_PIPELINE_VERSION -u PROCESSING_MAX_ATTEMPTS -u PROCESSING_JOB_TIMEOUT -u PROCESSING_LEASE_TTL -u PROCESSING_HEARTBEAT -u PROCESSING_RETRY_BASE -u PROCESSING_RETRY_CAP -u OUTBOX_POLL_INTERVAL -u OUTBOX_CLAIM_TTL -u OUTBOX_BATCH -u OUTBOX_REAPER_INTERVAL -u OUTBOX_RETENTION -u RELAY_CPU_LIMIT -u RELAY_MEM_LIMIT -u STAGING_ORPHAN_GRACE -u STAGING_FAILED_RETENTION -u ADMISSION_MAX_PENDING_PER_USER -u ADMISSION_MAX_PENDING -u ADMISSION_MAX_STAGED_BYTES go test -race -shuffle=on -count=1 -timeout=5m ./...
? mtusi-messenger/cmd/jobctl [no test files]
? mtusi-messenger/cmd/messenger [no test files]
? mtusi-messenger/cmd/migrate [no test files]
? mtusi-messenger/cmd/relay [no test files]
? mtusi-messenger/cmd/s3init [no test files]
? mtusi-messenger/cmd/worker [no test files]
? mtusi-messenger/internal/broker [no test files]
ok mtusi-messenger/internal/config 1.717s
ok mtusi-messenger/internal/domain 2.647s
? mtusi-messenger/internal/failpoint [no test files]
ok mtusi-messenger/internal/health 1.315s
ok mtusi-messenger/internal/imagecheck 3.766s
ok mtusi-messenger/internal/imageproc 2.400s
ok mtusi-messenger/internal/logger 2.338s
? mtusi-messenger/internal/outbox [no test files]
ok mtusi-messenger/internal/platform/cache 4.909s
? mtusi-messenger/internal/platform/cache/mocks [no test files]
ok mtusi-messenger/internal/platform/objectstore 6.507s
ok mtusi-messenger/internal/platform/password 3.349s
ok mtusi-messenger/internal/platform/token 3.304s
ok mtusi-messenger/internal/service/attachment 5.105s
? mtusi-messenger/internal/service/attachment/mocks [no test files]
ok mtusi-messenger/internal/service/chat 4.460s
? mtusi-messenger/internal/service/chat/mocks [no test files]
ok mtusi-messenger/internal/service/message 4.119s
? mtusi-messenger/internal/service/message/mocks [no test files]
ok mtusi-messenger/internal/service/session 5.771s
? mtusi-messenger/internal/service/session/mocks [no test files]
ok mtusi-messenger/internal/service/user 6.251s
? mtusi-messenger/internal/service/user/mocks [no test files]
ok mtusi-messenger/internal/storage/postgres 6.484s
? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files]
? mtusi-messenger/internal/storage/postgres/migrations [no test files]
? mtusi-messenger/internal/storage/redis [no test files]
? mtusi-messenger/internal/storage/redis/mocks [no test files]
ok mtusi-messenger/internal/transport/rest 6.893s
? mtusi-messenger/internal/transport/rest/internal/oas [no test files]
? mtusi-messenger/internal/transport/rest/mocks [no test files]
? mtusi-messenger/internal/worker [no test files]
? mtusi-messenger/tools/specgen [no test files]
+3
View File
@@ -0,0 +1,3 @@
# make validate PYTHON=.venv/bin/python 2026-10-30T22:22:13Z
.venv/bin/python scripts/validate_openapi.py
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
+3
View File
@@ -0,0 +1,3 @@
# lab5_variants 2026-10-30T20:08:36Z
variants: thumbnail 256x160, crop 128x128, optimized WebP 320x200; metadata == bytes
PASS: lab5 variant contract
View File
+8 -8
View File
@@ -3,23 +3,23 @@
# lb: haproxy:3.2-alpine
## 1. baseline: requests through LB by replica
18 52861386fddb
22 8587b4251b72
stats: api1=UP api2=UP api3=MAINT (resolution) api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
18 52861386fddb
22 8587b4251b72
stats: api1=UP api2=UP api3=MAINT (resolution) api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 2. start a temporary TCP proxy to postgres and a candidate replica behind the same network alias
instance-id: 9e9e905440d3, readiness while its database is reachable: 200
load balancer slot for the candidate: api3, stats: api1=UP api2=UP api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
load balancer slot for the candidate: api3, stats: api1=UP api2=UP api3=UP api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 3. cut the candidate's database access (stop only the TCP proxy)
candidate is still running: running, readiness: 503
waiting for the load balancer to mark api3 DOWN
api3 went DOWN 2s after its database was cut (check: inter 2s fall 2)
stats after failure: api1=UP api2=UP api3=DOWN api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
stats after failure: api1=UP api2=UP api3=DOWN api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
## 4. 40 requests through LB while the candidate is not ready
18 52861386fddb
22 8587b4251b72
18 52861386fddb
22 8587b4251b72
(the candidate must not appear above)
## 5. business writes through LB during the exclusion
@@ -28,4 +28,4 @@
"successful_rps": 1163.529,
## 6. cleanup
stats after cleanup: api1=UP api2=UP api3=MAINT (resolution) api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP
stats after cleanup: api1=UP api2=UP api3=MAINT (resolution) api4=MAINT (resolution) api5=MAINT (resolution) api6=MAINT (resolution) api7=MAINT (resolution) api8=MAINT (resolution) BACKEND=UP