3.3 KiB
Lab4 evidence — 2026-11-11
Стенд: Docker Compose, nginx на 127.0.0.1:18084, API ×2, PostgreSQL, Redis, MinIO. Секреты и session tokens в evidence не сохранялись.
Bootstrap и миграции
- MinIO server image:
bitnamilegacy/minio:2025.4.22-debian-12-r1@sha256:d7cd…e0cab. minio-init: bucketmessenger-attachmentsсоздан, anonymous access установленprivate, пользовательmessenger-apiсоздан, policymessenger-attachments-rwназначена.- Flyway: успешно проверены и применены 4 миграции, итоговая версия schema
v4. docker compose ps: две здоровые API-реплики; MinIO/PostgreSQL/Redis/nginx healthy; наружу опубликован только nginx.
Проверки
AttachmentServiceTest + AttachmentReconcilerTest: BUILD SUCCESSFUL, 10 tests.
tests/smoke.py: PASS: lab4 public API scenario.
student_tests/lab4_negative.py:
PASS: unknown/foreign attachment, foreign chat/user, MIME spoof, corruption,
byte limit and filename checks.
Persistence hook останавливал nginx, обе API, Redis, PostgreSQL и MinIO, затем запускал те же named volumes и повторял idempotent bucket bootstrap:
PASS: persistence preserved confirmed data and existing session.
Failover hook остановил replica из X-Instance-Id, обслужившую тестовый запрос:
{"observed_instances_before":2,"successful_writes":102,"failed_attempts":0,"first_recovery_seconds":1.386}
PASS: failover preserved confirmed data and existing session.
При остановленном MinIO:
PASS: unavailable S3 returns contract JSON 503
После запуска того же MinIO volume публичный smoke повторно завершился PASS, checksum скачанного original совпал.
Level 4: consistency, memory and private S3
Unit tests inject an interrupted request stream before S3 PUT and a repository failure after S3 PUT. The first leaves storage empty; the second verifies the compensating DELETE. Reconciler tests prove that an orphan younger than the one-hour grace period survives, an older orphan is deleted, dry-run never deletes, and a missing object is reported.
Bootstrap was executed again against the existing bucket and completed with exit code 0. The direct S3 probe (without application API) produced:
PASS: bucket is private and API credentials are non-admin
Full Gradle suite using the live Compose PostgreSQL/Redis/MinIO network:
BUILD SUCCESSFUL in 11m 47s
Concurrent memory experiment (evidence/upload-memory-2026-11-11.json):
{"concurrency":12,"successful_uploads":12,"payload_bytes_each":6835833,
"duration_seconds":10.156,"api_replicas":2,"memory_samples":5,
"baseline_api_memory_bytes":668467200,"peak_api_memory_bytes":839909375,
"peak_increase_bytes":171442175,"configured_max_concurrent_uploads_per_replica":3}
The memory values are the aggregate of both API containers from docker stats.
Sampling can miss a shorter peak, so this is an operational bound observation,
not a JVM heap proof. The code-level bounds are 10 MiB/request, 40M pixels and
three active uploads per replica.