ЛР 2 — PostgreSQL и сессии Redis
Skeleton contracts / contracts (pull_request) Failing after 35s

This commit is contained in:
Риц Дмитрий
2026-11-06 01:53:02 +03:00
parent 65003b6119
commit da5caa9137
26 changed files with 1775 additions and 33 deletions
+43
View File
@@ -0,0 +1,43 @@
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
labkos_two-api-1 labkos-two-api:lab2 "python -m messenger" api 9 seconds ago Up 7 seconds (healthy) 127.0.0.1:8080->8080/tcp
labkos_two-migrate-1 labkos-two-api:lab2 "python -m messenger…" migrate 2 minutes ago Exited (0) 2 minutes ago
labkos_two-postgres-1 postgres:17.6-bookworm "docker-entrypoint.s…" postgres 2 minutes ago Up About a minute (healthy) 5432/tcp
labkos_two-redis-1 redis:7.4.6-bookworm "docker-entrypoint.s…" redis 2 minutes ago Up About a minute (healthy) 6379/tcp
Applied: 001_initial
Schema is up to date
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
Before full restart (UTC)
/labkos_two-api-1 2026-11-05T22:42:13.724276004Z
/labkos_two-postgres-1 2026-11-05T22:40:53.482741183Z
/labkos_two-redis-1 2026-11-05T22:40:51.310589866Z
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
After full restart (UTC)
/labkos_two-api-1 2026-11-05T22:42:39.6528577Z
/labkos_two-postgres-1 2026-11-05T22:42:39.378949085Z
/labkos_two-redis-1 2026-11-05T22:42:39.28935528Z
appendonly
yes
appendfsync
always
synchronous_commit
--------------------
on
(1 row)
fsync
-------
on
(1 row)
PASS registration race (6 concurrent attempts): [201, 409, 409, 409, 409, 409]
PASS Basic login with a Unicode password containing a colon
PASS rollback: HTTP 400 and zero rows for rejected chat in PostgreSQL
PASS wrong password=401, logout=204, revoked token=401
PASS Redis session key has TTL (3597s left)
PASS redis outage: live=200 ready=503 Bearer=503 (2.012s) anonymous=401; same token after start (0.060s from docker compose start return)
PASS Redis restart did not revive revoked session
PASS postgres outage: live=200 ready=503 Bearer=503 (2.011s) anonymous=401; same token after start (0.088s from docker compose start return)
PASS 2s expiry: same token 200 before deadline and 401 after deadline
PASS manual PowerShell login, chat, message and history from REPORT.md
+38
View File
@@ -0,0 +1,38 @@
BEGIN
INSERT 0 1
INSERT 0 1
INSERT 0 1
INSERT 0 10000
ANALYZE
messages_in_test_chat
-----------------------
10000
(1 row)
First page (50 items plus one lookahead)
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.29..4.28 rows=51 width=78) (actual time=0.024..0.044 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history on messages (cost=0.29..782.85 rows=10000 width=78) (actual time=0.022..0.035 rows=51 loops=1)
Index Cond: (chat_id = '<fixture-uuid>'::uuid)
Buffers: shared hit=3
Planning:
Buffers: shared hit=18
Planning Time: 0.268 ms
Execution Time: 0.073 ms
(9 rows)
Deep page (after message 9000)
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.29..15.36 rows=51 width=78) (actual time=0.081..0.103 rows=51 loops=1)
Buffers: shared hit=3
-> Index Scan using messages_history on messages (cost=0.29..296.39 rows=1002 width=78) (actual time=0.079..0.094 rows=51 loops=1)
Index Cond: ((chat_id = '<fixture-uuid>'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 02:30:00+00'::timestamp with time zone, '<fixture-uuid>'::uuid)))
Buffers: shared hit=3
Planning Time: 0.178 ms
Execution Time: 0.185 ms
(7 rows)
ROLLBACK