Completed for a grade of four

This commit is contained in:
2026-11-19 16:48:52 +03:00
parent 248f8a5cb0
commit be2abbb734
50 changed files with 1831 additions and 532 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
Upload: 202 queued, then ready; instance=7a70d3b286da
Upload: 202 queued, then ready; instance=da6189641548
Anonymous S3 GET of known object: 403
Outsider metadata/content: 404
Download: 200; instance=f000ea12f8bd
Download: 200; instance=b89ba5975865
SHA-256: 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
PASS: uploading replica stopped; original served by another replica; stopped replica restored
+11 -13
View File
@@ -1,13 +1,11 @@
$ docker compose config --quiet
Exit code: 0
$ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
mtusi-messenger-lab5-api-1 mtusi-messenger:lab5 "java -XX:MaxRAMPerc…" api 8 minutes ago Up 2 minutes (healthy) 8080/tcp
mtusi-messenger-lab5-api-2 mtusi-messenger:lab5 "java -XX:MaxRAMPerc…" api 8 minutes ago Up 2 minutes (healthy) 8080/tcp
mtusi-messenger-lab5-broker-1 rabbitmq@sha256:cd4009416f83d7e5895020cd71b0963f3b8a4dfc3de74bbb6fb3bfe5f81f01e0 "/bin/sh /bootstrap.…" broker 19 hours ago Up 2 minutes (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp
mtusi-messenger-lab5-lb-1 haproxy:3.2.4-alpine "docker-entrypoint.s…" lb 19 hours ago Up About a minute (healthy) 127.0.0.1:8085->8080/tcp
mtusi-messenger-lab5-postgres-1 postgres:17.6-alpine3.22 "docker-entrypoint.s…" postgres 19 hours ago Up 2 minutes (healthy) 5432/tcp
mtusi-messenger-lab5-redis-1 redis:8.4.0-alpine "docker-entrypoint.s…" redis 19 hours ago Up 2 minutes (healthy) 6379/tcp
mtusi-messenger-lab5-s3-1 quay.io/minio/minio@sha256:14cea493d9a34af32f524e538b8346cf79f3321eff8e708c1e2960462bd8936e "/usr/bin/docker-ent…" s3 19 hours ago Up 2 minutes (healthy) 9000/tcp
mtusi-messenger-lab5-worker-1 mtusi-messenger:lab5 "java -XX:MaxRAMPerc…" worker 8 minutes ago Up 2 minutes (healthy) 8080/tcp
api Up 10 seconds (healthy) 8080/tcp
api Up 10 seconds (healthy) 8080/tcp
broker Up 19 seconds (healthy) 4369/tcp, 5671-5672/tcp, 15691-15692/tcp, 25672/tcp
lb Up 6 seconds (healthy) 127.0.0.1:8086->8080/tcp
postgres Up 19 seconds (healthy) 5432/tcp
redis Up 19 seconds (healthy) 6379/tcp
s3 Up 19 seconds (healthy) 9000/tcp
worker Up 10 seconds (healthy) 8080/tcp
Worker memory bytes=1073741824; NanoCPUs=1000000000
1.6.0
libsharpyuv: 0.4.2
+6 -2
View File
@@ -1,6 +1,6 @@
Command: rtk gradlew compileKotlin compileTestKotlin test --console=plain (JDK 21)
BUILD SUCCESSFUL
Tests: 94; failures: 0; errors: 0; skipped: 0
Tests: 98; failures: 0; errors: 0; skipped: 0
com.mtusi.messenger.main.infrastructure.controllers.attachment.AttachmentControllerTest: tests=3 failures=0
com.mtusi.messenger.main.infrastructure.controllers.authentication.AuthenticationControllerTest: tests=9 failures=0
com.mtusi.messenger.main.infrastructure.controllers.chat.ChatControllerTest: tests=6 failures=0
@@ -22,12 +22,16 @@ com.mtusi.messenger.main.infrastructure.services.attachment.AttachmentPipelineTe
busy redelivery lets the next attachment finish before lease expiration()
worker distinguishes permanent image errors from bounded transient failures()
stopped worker leaves a durable queued attachment and redelivery preserves its result()
com.mtusi.messenger.main.infrastructure.services.attachment.ImageProcessingServiceTest: tests=6 failures=0
com.mtusi.messenger.main.infrastructure.services.attachment.ImageProcessingServiceTest: tests=10 failures=0
worker subprocess preserves permanent image failures()
PNG EXIF orientation is applied before resizing()
transparent and semitransparent pixels are composited on white()
invalid images and MIME mismatches are rejected before publishing a thumbnail()
published variants apply orientation and preserve the centered crop()
missing or unknown EXIF orientation preserves the normal image()
all JPEG EXIF orientations rotate or mirror pixels and strip orientation from the thumbnail()
optimized WebP preserves alpha and never enlarges a small source()
image subprocess stops at its deadline()
thumbnail fits the box floors dimensions and never enlarges the source()
com.mtusi.messenger.main.infrastructure.services.attachment.ImageValidatorTest: tests=3 failures=0
com.mtusi.messenger.main.infrastructure.services.attachment.LegacyAttachmentMigrationTest: tests=1 failures=0
+5
View File
@@ -0,0 +1,5 @@
PASS: producer SIGKILL after PostgreSQL commit and before publish; outbox survived; id=dfeea134-7def-4f55-a601-825dc8a56208
PASS: outbox recovered the same attachment with all three variants; id=dfeea134-7def-4f55-a601-825dc8a56208
PASS: worker exited 86 after writing S3 objects, before result commit and ack; id=cf5b21c7-ecc8-4c43-8a28-a3f3761d1378
PASS: redelivery recovered the same id, original and three variants on attempt 2; id=cf5b21c7-ecc8-4c43-8a28-a3f3761d1378
PASS: failed job listed, replayed with same id on attempt 2, and replay refused after ready; id=99a5cbcd-5cde-482b-860c-c375d8a42af9
+17 -17
View File
@@ -1,23 +1,23 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8085"
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8086"
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
Before restart:
/mtusi-messenger-lab5-api-1 2026-11-17T11:48:25.6974278Z
/mtusi-messenger-lab5-api-2 2026-11-17T11:48:25.799164633Z
/mtusi-messenger-lab5-broker-1 2026-11-17T11:48:15.954373295Z
/mtusi-messenger-lab5-lb-1 2026-11-17T11:48:28.901775676Z
/mtusi-messenger-lab5-postgres-1 2026-11-17T11:48:15.943166503Z
/mtusi-messenger-lab5-redis-1 2026-11-17T11:48:15.95361167Z
/mtusi-messenger-lab5-s3-1 2026-11-17T11:48:15.94897392Z
/mtusi-messenger-lab5-worker-1 2026-11-17T11:48:25.696508175Z
/mtusi-messenger-lab5-level4-api-1 2026-11-18T11:08:43.347539047Z
/mtusi-messenger-lab5-level4-api-2 2026-11-18T11:08:17.102104132Z
/mtusi-messenger-lab5-level4-broker-1 2026-11-18T11:08:13.123424672Z
/mtusi-messenger-lab5-level4-lb-1 2026-11-18T11:05:22.404306926Z
/mtusi-messenger-lab5-level4-postgres-1 2026-11-18T11:05:06.926939794Z
/mtusi-messenger-lab5-level4-redis-1 2026-11-18T11:05:06.922586211Z
/mtusi-messenger-lab5-level4-s3-1 2026-11-18T11:07:45.175138173Z
/mtusi-messenger-lab5-level4-worker-1 2026-11-18T11:08:24.920627553Z
After restart:
/mtusi-messenger-lab5-api-1 2026-11-17T11:52:14.708903753Z
/mtusi-messenger-lab5-api-2 2026-11-17T11:52:14.820903586Z
/mtusi-messenger-lab5-broker-1 2026-11-17T11:52:04.990389887Z
/mtusi-messenger-lab5-lb-1 2026-11-17T11:52:17.919454796Z
/mtusi-messenger-lab5-postgres-1 2026-11-17T11:52:04.990403929Z
/mtusi-messenger-lab5-redis-1 2026-11-17T11:52:04.984496471Z
/mtusi-messenger-lab5-s3-1 2026-11-17T11:52:04.992642512Z
/mtusi-messenger-lab5-worker-1 2026-11-17T11:52:14.708902794Z
/mtusi-messenger-lab5-level4-api-1 2026-11-18T11:09:23.075147802Z
/mtusi-messenger-lab5-level4-api-2 2026-11-18T11:09:22.927327177Z
/mtusi-messenger-lab5-level4-broker-1 2026-11-18T11:09:13.628215922Z
/mtusi-messenger-lab5-level4-lb-1 2026-11-18T11:09:26.709695053Z
/mtusi-messenger-lab5-level4-postgres-1 2026-11-18T11:09:13.629343672Z
/mtusi-messenger-lab5-level4-redis-1 2026-11-18T11:09:13.621602214Z
/mtusi-messenger-lab5-level4-s3-1 2026-11-18T11:09:13.629312422Z
/mtusi-messenger-lab5-level4-worker-1 2026-11-18T11:09:22.928541802Z
+5 -5
View File
@@ -1,10 +1,10 @@
Container mtusi-messenger-lab5-s3-1 Running
Container mtusi-messenger-lab5-level4-s3-1 Running
Bucket created successfully `local/messenger-attachments`.
Access permission for `local/messenger-attachments` is set to `private`
Container mtusi-messenger-lab5-s3-1 Running
Container mtusi-messenger-lab5-level4-s3-1 Running
Bucket created successfully `local/messenger-attachments`.
Access permission for `local/messenger-attachments` is set to `private`
Container mtusi-messenger-lab5-s3-1 Running
PASS: app cannot administer MinIO, create buckets, change policy or write outside originals/
wget: can't connect to remote host (172.26.0.2): Connection refused
Container mtusi-messenger-lab5-level4-s3-1 Running
PASS: app cannot administer MinIO, create buckets, change policy or write to an unrelated prefix
wget: can't connect to remote host (172.27.0.4): Connection refused
PASS: console unavailable from shared network
+1 -1
View File
@@ -1,2 +1,2 @@
python3 tests/smoke.py --base-url "http://localhost:8085"
python3 tests/smoke.py --base-url "http://localhost:8086"
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
+3 -3
View File
@@ -1,3 +1,3 @@
PASS: worker stopped; upload 202 queued; message accepted; content 409; attachment_id=0305bfe5-e30e-47cc-b81e-4f2c578273a6
PASS: both APIs and broker restarted with existing volumes; same attachment remains queued; attachment_id=0305bfe5-e30e-47cc-b81e-4f2c578273a6
PASS: same accepted job reached ready; original unchanged; thumbnail JPEG 256x160 with matching checksum; attachment_id=0305bfe5-e30e-47cc-b81e-4f2c578273a6
PASS: worker stopped; upload 202 queued; message accepted; content 409; attachment_id=5fba0009-e3d4-4c96-b77d-472ead517cda
PASS: both APIs and broker restarted with existing volumes; same attachment remains queued; attachment_id=5fba0009-e3d4-4c96-b77d-472ead517cda
PASS: same accepted job reached ready; original unchanged; thumbnail JPEG 256x160 with matching checksum; attachment_id=5fba0009-e3d4-4c96-b77d-472ead517cda