ЛР 2: собственные тесты (student_tests), lifecycle и SIGTERM под compose

This commit is contained in:
2026-11-03 11:33:16 +03:00
parent aa1b644585
commit 3feb4a9da3
6 changed files with 810 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
PASS two users created and read two messages: HTTP 201, then HTTP 200
PASS third user cannot read or write the chat: HTTP 404
PASS request logs include IDs and statuses, without message contents
Command: scripts/restart.sh (API + PostgreSQL + Valkey, volumes kept)
PASS after restart: same tokens read the same history
PASS logout revokes only alice's session; bob's session still works
PASS persistent lifecycle: data and sessions survive full restart
+6
View File
@@ -0,0 +1,6 @@
Image: mtusi-messenger:lab2
Scenario: idle; docker stop --timeout 10 mtusi-messenger-sigterm-60edb300
PASS idle: exit code 0; shutdown 0.339s; new connections rejected after 0.119s
Scenario: incomplete POST; docker stop --timeout 10 mtusi-messenger-sigterm-859f8a87
PASS incomplete POST: exit code 0; shutdown 8.356s; new connections rejected after 0.117s
PASS SIGTERM: both scenarios completed within 10 seconds
+15
View File
@@ -0,0 +1,15 @@
Testing http://localhost:8080
PASS malformed JSON and invalid UTF-8 -> 400 with error envelope
PASS duplicate username -> 409
PASS outsider cannot access chat -> 404
PASS empty/whitespace message -> 400
PASS extra JSON field -> 400
PASS pagination: 7 messages read through multiple pages
PASS concurrency: 10 clients sent 100 messages; exactly 100 unique messages stored
PASS invalid chat UUID -> 400; unknown valid UUID -> 404
PASS chat members: 1..100, unique, existing, caller included
PASS invalid cursor/limit and cursor from another chat -> 400
PASS pagination: 7 chats, changing limit between pages
PASS strict types, Unicode, password rules, Bearer-only identification
PASS: 12 student test scenarios completed