ЛР5 - БВТ2302 - Зюлина - на 3

This commit is contained in:
2026-11-23 18:11:01 +03:00
parent 276dbdad8a
commit 69c62d13d3
37 changed files with 1914 additions and 57 deletions
+13
View File
@@ -0,0 +1,13 @@
Дата проверок: 2026-11-19.
Команды и результат:
- scripts/check_contract.py — PASS: offline skeleton structure and local refs.
- python -m compileall -q src alembic scripts student-tests — PASS, exit 0.
- docker compose --env-file .env config --quiet — PASS, exit 0.
- docker compose up -d — PASS; API replicas healthy, Redis Streams broker healthy, MinIO healthy; GET /health/ready returned 200.
- tests/smoke.py --base-url http://localhost:8080 — PASS: lab5 public API scenario including attachment processing, original checksum, thumbnail JPEG dimensions/checksum, ACL and logout.
- tests/resilience.py --mode persistence --action-script scripts/restart.bat — PASS: confirmed data and existing session preserved after restarting the API and persistent stores.
- tests/resilience.py --mode failover --action-script scripts/stop-one.bat — PASS: 2 API instances observed, 99 successful writes, 0 failed attempts, first recovery 1.812 seconds.
- student-tests/worker_recovery.py — PASS: upload remained queued while the worker was stopped; its message reference and durable Stream job survived API/broker restart; after worker restart the original bytes and JPEG thumbnail were ready and checksummed.
All tests use synthetic users and images. Container lifecycle evidence is stored in persistence-actions.txt and failover-actions.txt. No credentials or session tokens are included.
+1
View File
@@ -0,0 +1 @@
2026-11-19 23:09:18 +03:00 target=b15098c4-fcae-4326-b6dc-fd25c6260e33 service=api1 container=/mtusi2026lab5-fork-api1-1
+34
View File
@@ -0,0 +1,34 @@
[2026-11-19 23:04:06 +03:00]
before service=db container=/mtusi2026lab5-fork-db-1 started_at=2026-11-19T20:00:39.579332837Z
before service=redis container=/mtusi2026lab5-fork-redis-1 started_at=2026-11-19T20:00:39.575373895Z
before service=redis-broker container=/mtusi2026lab5-fork-redis-broker-1 started_at=2026-11-19T20:00:39.568858881Z
before service=minio container=/mtusi2026lab5-fork-minio-1 started_at=2026-11-19T20:00:39.551271805Z
before service=api1 container=/mtusi2026lab5-fork-api1-1 started_at=2026-11-19T20:00:47.198764446Z
before service=api2 container=/mtusi2026lab5-fork-api2-1 started_at=2026-11-19T20:00:46.977452442Z
before service=worker container=/mtusi2026lab5-fork-worker-1 started_at=2026-11-19T20:00:47.146732512Z
before service=lb container=/mtusi2026lab5-fork-lb-1 started_at=2026-11-19T20:00:47.6772409Z
after service=db container=/mtusi2026lab5-fork-db-1 started_at=2026-11-19T20:03:35.313346727Z
after service=redis container=/mtusi2026lab5-fork-redis-1 started_at=2026-11-19T20:03:35.398165353Z
after service=redis-broker container=/mtusi2026lab5-fork-redis-broker-1 started_at=2026-11-19T20:03:35.036261483Z
after service=minio container=/mtusi2026lab5-fork-minio-1 started_at=2026-11-19T20:03:34.887589385Z
after service=api1 container=/mtusi2026lab5-fork-api1-1 started_at=2026-11-19T20:03:35.824457829Z
after service=api2 container=/mtusi2026lab5-fork-api2-1 started_at=2026-11-19T20:03:35.839532317Z
after service=worker container=/mtusi2026lab5-fork-worker-1 started_at=2026-11-19T20:04:02.891851437Z
after service=lb container=/mtusi2026lab5-fork-lb-1 started_at=2026-11-19T20:03:35.857149684Z
[2026-11-19 23:09:01 +03:00]
before service=db container=/mtusi2026lab5-fork-db-1 started_at=2026-11-19T20:03:35.313346727Z
before service=redis container=/mtusi2026lab5-fork-redis-1 started_at=2026-11-19T20:03:35.398165353Z
before service=redis-broker container=/mtusi2026lab5-fork-redis-broker-1 started_at=2026-11-19T20:07:56.052873003Z
before service=minio container=/mtusi2026lab5-fork-minio-1 started_at=2026-11-19T20:03:34.887589385Z
before service=api1 container=/mtusi2026lab5-fork-api1-1 started_at=2026-11-19T20:07:55.995573487Z
before service=api2 container=/mtusi2026lab5-fork-api2-1 started_at=2026-11-19T20:07:55.995460617Z
before service=worker container=/mtusi2026lab5-fork-worker-1 started_at=2026-11-19T20:08:01.693702443Z
before service=lb container=/mtusi2026lab5-fork-lb-1 started_at=2026-11-19T20:07:55.813349229Z
after service=db container=/mtusi2026lab5-fork-db-1 started_at=2026-11-19T20:08:30.153170554Z
after service=redis container=/mtusi2026lab5-fork-redis-1 started_at=2026-11-19T20:08:30.692739794Z
after service=redis-broker container=/mtusi2026lab5-fork-redis-broker-1 started_at=2026-11-19T20:08:29.755589166Z
after service=minio container=/mtusi2026lab5-fork-minio-1 started_at=2026-11-19T20:08:30.153115348Z
after service=api1 container=/mtusi2026lab5-fork-api1-1 started_at=2026-11-19T20:08:30.692688221Z
after service=api2 container=/mtusi2026lab5-fork-api2-1 started_at=2026-11-19T20:08:30.715507613Z
after service=worker container=/mtusi2026lab5-fork-worker-1 started_at=2026-11-19T20:08:57.830135515Z
after service=lb container=/mtusi2026lab5-fork-lb-1 started_at=2026-11-19T20:08:30.615613474Z
+4
View File
@@ -0,0 +1,4 @@
Worker recovery demonstration — 2026-11-19
Command: python student-tests/worker_recovery.py
Result: PASS. Stopped worker; uploaded sample.png and received 202/queued; linked it in a message; original content returned 409 while queued; restarted api1, api2, redis-broker and load balancer with the worker stopped; started worker; attachment reached ready. Original bytes matched fixture SHA-256. Thumbnail downloaded as JPEG at 256x160 and matched its metadata SHA-256.
Container lifecycle timestamps are recorded in evidence/persistence-actions.txt. Test users are synthetic. No tokens or credentials recorded.