Completed for a grade of three

This commit is contained in:
2026-11-18 13:55:24 +03:00
parent cd84a6fd36
commit 248f8a5cb0
77 changed files with 4100 additions and 251 deletions
+6
View File
@@ -0,0 +1,6 @@
Upload: 202 queued, then ready; instance=7a70d3b286da
Anonymous S3 GET of known object: 403
Outsider metadata/content: 404
Download: 200; instance=f000ea12f8bd
SHA-256: 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
PASS: uploading replica stopped; original served by another replica; stopped replica restored
+4
View File
@@ -0,0 +1,4 @@
$ make check
python3 scripts/check_contract.py
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
Exit code: 0
+13
View File
@@ -0,0 +1,13 @@
$ 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
+45
View File
@@ -0,0 +1,45 @@
Command: rtk gradlew compileKotlin compileTestKotlin test --console=plain (JDK 21)
BUILD SUCCESSFUL
Tests: 94; 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
com.mtusi.messenger.main.infrastructure.controllers.health.HealthControllerTest: tests=2 failures=0
com.mtusi.messenger.main.infrastructure.controllers.message.MessageConcurrencyTest: tests=1 failures=0
com.mtusi.messenger.main.infrastructure.controllers.message.MessageControllerTest: tests=7 failures=0
com.mtusi.messenger.main.infrastructure.controllers.message.MessageIdempotencyTest: tests=7 failures=0
com.mtusi.messenger.main.infrastructure.controllers.user.UserControllerTest: tests=11 failures=0
com.mtusi.messenger.main.infrastructure.dto.AttachmentJobContractTest: tests=1 failures=0
job envelope requires every field mandated by the public schema()
com.mtusi.messenger.main.infrastructure.repositories.authentication.session.cache.RedisSessionCacheRepositoryTest: tests=3 failures=0
com.mtusi.messenger.main.infrastructure.repositories.chat.ExposedChatRepositoryTest: tests=2 failures=0
com.mtusi.messenger.main.infrastructure.repositories.message.MessageAttachmentsQueryTest: tests=1 failures=0
com.mtusi.messenger.main.infrastructure.services.attachment.AttachmentCleanupTest: tests=2 failures=0
expired failed attachments lose partially published files()
orphan cleanup respects grace and fences late publishers()
com.mtusi.messenger.main.infrastructure.services.attachment.AttachmentPipelineTest: tests=4 failures=0
attempts are bounded and failed attachments reject content and message links()
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
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()
missing or unknown EXIF orientation preserves the normal image()
all JPEG EXIF orientations rotate or mirror pixels and strip orientation from the thumbnail()
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
migration schedules a thumbnail for an existing lab4 original()
com.mtusi.messenger.main.infrastructure.services.attachment.jobs.RabbitMqJobBrokerServiceTest: tests=1 failures=0
confirmed job survives broker restart and negative acknowledgement preserves its identity()
com.mtusi.messenger.main.infrastructure.services.authentication.CrossReplicaRevocationTest: tests=2 failures=0
com.mtusi.messenger.main.infrastructure.services.authentication.SessionLookupSingleFlightTest: tests=4 failures=0
com.mtusi.messenger.main.infrastructure.services.hashing.DefaultHashingServiceTest: tests=4 failures=0
com.mtusi.messenger.main.plugins.CorsTest: tests=2 failures=0
com.mtusi.messenger.main.plugins.DatabaseMigrationTest: tests=1 failures=0
com.mtusi.messenger.main.plugins.DependencyFailureTest: tests=5 failures=0
com.mtusi.messenger.main.plugins.InstanceIdTest: tests=1 failures=0
com.mtusi.messenger.main.plugins.SessionCacheTest: tests=3 failures=0
com.mtusi.messenger.main.utils.TemporaryUploadTest: tests=2 failures=0
+23
View File
@@ -0,0 +1,23 @@
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://localhost:8085"
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
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
+10
View File
@@ -0,0 +1,10 @@
Container mtusi-messenger-lab5-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
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
PASS: console unavailable from shared network
+2
View File
@@ -0,0 +1,2 @@
python3 tests/smoke.py --base-url "http://localhost:8085"
PASS: lab5 public API scenario; infrastructure and grading evidence remain separate.
+3
View File
@@ -0,0 +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