ЛР4 БВТ2304 Запорожец на 3
Вложения: приватный S3-bucket (RustFS 1.0.4) + метаданные в PostgreSQL, upload PNG/JPEG с лимитами до декодирования, авторизованный download, attachment_ids в сообщениях, идемпотентный bootstrap bucket, failover/persistence/S3-down тесты и REPORT.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
# 2026-11-12T15:42:03Z, commit ec540a1
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 125, "failed_attempts": 0, "first_recovery_seconds": 4.666}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
mtusi-lab4-api-1 Up 2 minutes (healthy)
|
||||
mtusi-lab4-api-2 Up 6 seconds (healthy)
|
||||
python3 tests/resilience.py --mode failover --action-script "scripts/stop-one.sh" --base-url "http://lb:8080"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 125, "failed_attempts": 0, "first_recovery_seconds": 4.244}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
mtusi-lab4-api-1 Up 6 seconds (healthy)
|
||||
mtusi-lab4-api-2 Up 35 seconds (healthy)
|
||||
|
||||
# evidence/stop-one.log (what the hook really stopped):
|
||||
2026-11-12T15:42:09Z mode=stop instance=406b73449330-7c6529 container=mtusi-lab4-api-2 state=exited exit=0 finished=2026-11-12T15:42:12.725820822Z
|
||||
2026-11-12T15:42:38Z mode=stop instance=9f9f380ebef7-2fe1ee container=mtusi-lab4-api-1 state=exited exit=0 finished=2026-11-12T15:42:41.725669058Z
|
||||
@@ -0,0 +1,21 @@
|
||||
# 2026-11-12T15:43:02Z, commit ec540a1
|
||||
python3 tests/resilience.py --mode persistence --action-script "scripts/restart.sh" --base-url "http://lb: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.
|
||||
|
||||
# hook scope (StartedAt before/after of every process):
|
||||
before:
|
||||
/mtusi-lab4-api-1 2026-11-12T15:43:25.945855638Z
|
||||
/mtusi-lab4-api-2 2026-11-12T15:43:26.378025301Z
|
||||
/mtusi-lab4-lb-1 2026-11-12T15:43:32.867507504Z
|
||||
/mtusi-lab4-postgres-1 2026-11-12T15:43:15.880707203Z
|
||||
/mtusi-lab4-s3-1 2026-11-12T15:43:15.991679035Z
|
||||
/mtusi-lab4-valkey-1 2026-11-12T15:43:16.182909146Z
|
||||
after:
|
||||
/mtusi-lab4-api-1 2026-11-12T15:43:54.05450379Z
|
||||
/mtusi-lab4-api-2 2026-11-12T15:43:54.412315531Z
|
||||
/mtusi-lab4-lb-1 2026-11-12T15:44:00.933617411Z
|
||||
/mtusi-lab4-postgres-1 2026-11-12T15:43:44.505071692Z
|
||||
/mtusi-lab4-s3-1 2026-11-12T15:43:44.304941151Z
|
||||
/mtusi-lab4-valkey-1 2026-11-12T15:43:44.162913947Z
|
||||
ready
|
||||
@@ -0,0 +1,7 @@
|
||||
# 2026-11-12T15:41:38Z, commit ec540a1
|
||||
python3 scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
python3 scripts/validate_openapi.py
|
||||
PASS: full OpenAPI 3.1 and JSON Schema validation; application NOT tested.
|
||||
python3 tests/smoke.py --base-url "http://lb:8080"
|
||||
PASS: lab4 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,28 @@
|
||||
# 2026-11-12T15:41:26Z, commit ec540a1
|
||||
NAME IMAGE STATUS PORTS
|
||||
mtusi-lab4-api-1 mtusi-lab4-api:local Up About a minute (healthy) 8080/tcp
|
||||
mtusi-lab4-api-2 mtusi-lab4-api:local Up 3 minutes (healthy) 8080/tcp
|
||||
mtusi-lab4-api-ttl-1 mtusi-lab4-api:local Exited (137) 38 seconds ago
|
||||
mtusi-lab4-lb-1 haproxy:3.2.8-alpine Up 8 minutes (healthy) 127.0.0.1:8080->8080/tcp, 127.0.0.1:8404->8404/tcp
|
||||
mtusi-lab4-migrate-1 mtusi-lab4-api:local Exited (0) 2 minutes ago
|
||||
mtusi-lab4-postgres-1 postgres:17.7-bookworm Up 44 seconds (healthy) 5432/tcp
|
||||
mtusi-lab4-s3-1 rustfs/rustfs:1.0.4@sha256:ed9210d6411d77ffceb70d94b964a3cb7d225983368bc25bebe01e995293dcc2 Up 2 minutes (healthy) 9000-9001/tcp
|
||||
mtusi-lab4-s3-init-1 mtusi-lab4-api:local Exited (0) 2 minutes ago
|
||||
mtusi-lab4-valkey-1 valkey/valkey:8.1.4 Up 58 seconds (healthy) 6379/tcp
|
||||
|
||||
# s3-init (idempotent bucket bootstrap + anonymous access check):
|
||||
bucket messenger-attachments: exists
|
||||
bucket messenger-attachments: no bucket policy (private)
|
||||
anonymous GET messenger-attachments/_bootstrap/private-check: HTTP 403 (denied)
|
||||
bucket messenger-attachments: exists
|
||||
bucket messenger-attachments: no bucket policy (private)
|
||||
anonymous GET messenger-attachments/_bootstrap/private-check: HTTP 403 (denied)
|
||||
|
||||
# repeated bootstrap run (must not touch existing bucket):
|
||||
bucket messenger-attachments: exists
|
||||
bucket messenger-attachments: no bucket policy (private)
|
||||
anonymous GET messenger-attachments/_bootstrap/private-check: HTTP 403 (denied)
|
||||
|
||||
# volumes:
|
||||
mtusi-lab4_pgdata
|
||||
mtusi-lab4_s3data
|
||||
@@ -0,0 +1,33 @@
|
||||
# 2026-11-12T15:44:05Z, commit ec540a1
|
||||
PASS test_png_and_jpeg_roundtrip (2.4s)
|
||||
PASS test_message_with_attachments (2.2s)
|
||||
PASS test_foreign_attachment_rejected (2.4s)
|
||||
PASS test_limits_and_mime (2.5s)
|
||||
PASS test_dangerous_filenames (2.7s)
|
||||
anonymous GET object/list -> 403
|
||||
PASS test_bucket_private_outside_api (3.4s)
|
||||
PASS test_no_local_copy_on_api (3.2s)
|
||||
uploaded via 406b73449330-d4521b, downloaded via 9f9f380ebef7-65ee96
|
||||
PASS test_failover_of_uploading_replica (8.4s)
|
||||
PASS test_s3_unavailable (14.1s)
|
||||
9/9 passed
|
||||
PASS test_session_across_replicas (1.0s)
|
||||
PASS test_same_key_concurrent_across_replicas (4.5s)
|
||||
PASS test_same_key_concurrent_different_bodies (3.6s)
|
||||
PASS test_key_scope_and_format (2.9s)
|
||||
PASS test_replay_rechecks_session (2.3s)
|
||||
PASS test_transient_failure_not_recorded (7.8s)
|
||||
PASS test_sigterm_drain (11.4s)
|
||||
PASS test_infrastructure_rules (1.0s)
|
||||
8/8 passed
|
||||
PASS test_wrong_password (1.4s)
|
||||
PASS test_logout (1.1s)
|
||||
PASS test_short_ttl (3.7s)
|
||||
PASS test_username_race (5.4s)
|
||||
PASS test_chat_rollback (1.5s)
|
||||
PASS test_cursor_rules (2.2s)
|
||||
PASS test_valkey_cache_role (2.1s)
|
||||
PASS test_revoke_during_cache_partition (3.1s)
|
||||
PASS test_valkey_down (6.1s)
|
||||
PASS test_postgres_down (11.4s)
|
||||
10/10 passed
|
||||
Reference in New Issue
Block a user