forked from mtusi2026/mtusi2026lab2
Lab 2: PostgreSQL storage and Redis sessions
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
# Среда и область проверки
|
||||
|
||||
Дата: 19.10.2026. Приложенные логи относятся к предварительному native-прогону,
|
||||
а не к Docker Desktop студента.
|
||||
|
||||
- Python 3.12.14, PostgreSQL 16.15, Redis 7.0.15, x86_64.
|
||||
- 9 видимых CPU, cgroup RAM limit 8 GiB.
|
||||
- Использовались настоящие PostgreSQL и Redis, не моки хранилищ.
|
||||
- tests/smoke.py и tests/resilience.py запускались без изменений.
|
||||
- Все 16 student-tests прошли; итоговый прогон — 5.023 с.
|
||||
- EXPLAIN выполнен на 10000 временных сообщениях; обе страницы используют индекс.
|
||||
- Короткий TTL, остановка каждого хранилища и полный рестарт реальных процессов прошли.
|
||||
- native-restart-processes.json фиксирует PID api/postgres/redis до/после полного рестарта.
|
||||
- Compose CLI 2.40.3 проверил compose.yaml командой config --quiet, код завершения 0.
|
||||
- Docker daemon отсутствует. Docker build/up, закреплённые версии образов,
|
||||
Windows restart.cmd и Docker restart.sh здесь не запускались.
|
||||
|
||||
На компьютере студента нужно повторить команды START_HERE_RU.md, сохранить вывод
|
||||
в отдельные файлы и обновить REPORT.md. Эти результаты не гарантируют оценку.
|
||||
@@ -0,0 +1,2 @@
|
||||
.venv/bin/python scripts/check_contract.py
|
||||
PASS: offline skeleton structure, local refs and Python syntax; application NOT tested.
|
||||
@@ -0,0 +1,5 @@
|
||||
Compose CLI version: 2.40.3
|
||||
Command: docker compose config --quiet
|
||||
Result: exit 0, no validation output
|
||||
Synthetic environment supplied for POSTGRES_DB/USER/PASSWORD.
|
||||
Docker daemon/build/up were not tested in this environment.
|
||||
@@ -0,0 +1,21 @@
|
||||
PostgreSQL 16.15 (Ubuntu 16.15-0ubuntu0.24.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0, 64-bit
|
||||
Fixture messages: 10000
|
||||
FIRST PAGE: LIMIT 51 (50 items + lookahead)
|
||||
Limit (cost=0.29..5.65 rows=51 width=76) (actual time=0.006..0.012 rows=51 loops=1)
|
||||
Buffers: shared hit=3
|
||||
-> Index Scan using messages_history_idx on messages (cost=0.29..1052.02 rows=10000 width=76) (actual time=0.005..0.009 rows=51 loops=1)
|
||||
Index Cond: (chat_id = '799a61aa-3fa2-4535-84e9-28889941c357'::uuid)
|
||||
Buffers: shared hit=3
|
||||
Planning:
|
||||
Buffers: shared hit=18
|
||||
Planning Time: 0.046 ms
|
||||
Execution Time: 0.018 ms
|
||||
LATER PAGE: after message 9000, LIMIT 51
|
||||
Limit (cost=0.29..17.73 rows=51 width=76) (actual time=0.004..0.012 rows=51 loops=1)
|
||||
Buffers: shared hit=4
|
||||
-> Index Scan using messages_history_idx on messages (cost=0.29..375.19 rows=1096 width=76) (actual time=0.003..0.008 rows=51 loops=1)
|
||||
Index Cond: ((chat_id = '799a61aa-3fa2-4535-84e9-28889941c357'::uuid) AND (ROW(created_at, id) > ROW('2026-01-01 00:00:00.009+00'::timestamp with time zone, 'a598e58f-565a-4ff7-b30b-19dcc8524574'::uuid)))
|
||||
Buffers: shared hit=4
|
||||
Planning Time: 0.035 ms
|
||||
Execution Time: 0.024 ms
|
||||
PASS: 10000 messages; first/later pages use messages_history_idx; fixtures rolled back
|
||||
@@ -0,0 +1,3 @@
|
||||
PASS: SESSION_TTL_SECONDS=2; active token becomes 401 after expiry
|
||||
PASS: redis outage -> bounded 503; live=200; anonymous=401; old token recovers
|
||||
PASS: postgres outage -> bounded 503; live=200; anonymous=401; old token recovers
|
||||
@@ -0,0 +1,3 @@
|
||||
PASS: SESSION_TTL_SECONDS=2; active token becomes 401 after expiry
|
||||
PASS: redis outage -> bounded 503; live=200; anonymous=401; old token recovers
|
||||
PASS: postgres outage -> bounded 503; live=200; anonymous=401; old token recovers
|
||||
@@ -0,0 +1,2 @@
|
||||
SKIP 01_initial.sql
|
||||
SKIP 02_chat_order.sql
|
||||
@@ -0,0 +1,2 @@
|
||||
APPLIED 01_initial.sql
|
||||
APPLIED 02_chat_order.sql
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"before": {
|
||||
"api": {
|
||||
"pid": 24,
|
||||
"running": true
|
||||
},
|
||||
"postgres": {
|
||||
"pid": 3775,
|
||||
"running": true
|
||||
},
|
||||
"redis": {
|
||||
"pid": 3674,
|
||||
"running": true
|
||||
}
|
||||
},
|
||||
"after": {
|
||||
"api": {
|
||||
"pid": 4090,
|
||||
"running": true
|
||||
},
|
||||
"postgres": {
|
||||
"pid": 4077,
|
||||
"running": true
|
||||
},
|
||||
"redis": {
|
||||
"pid": 4084,
|
||||
"running": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,3 @@
|
||||
api dafaccaefd42497d456f3e26d23ac6be4f70f0e37949c138328d0c97295311b3 2026-10-19T20:18:14.844180844Z running
|
||||
postgres 9c96af6664fb6aae298d6153c6ecca2d88260d0e45c6e04f9642b45c669db5fb 2026-10-19T20:18:07.973412169Z running
|
||||
redis a8784a6f176fdff2ede5e350216d9fc94963c57ff611944cac275fc61df49b5b 2026-10-19T20:18:07.799371434Z running
|
||||
@@ -0,0 +1,3 @@
|
||||
api dafaccaefd42497d456f3e26d23ac6be4f70f0e37949c138328d0c97295311b3 2026-10-19T20:11:47.430509928Z running
|
||||
postgres 9c96af6664fb6aae298d6153c6ecca2d88260d0e45c6e04f9642b45c669db5fb 2026-10-19T18:28:42.086328397Z running
|
||||
redis a8784a6f176fdff2ede5e350216d9fc94963c57ff611944cac275fc61df49b5b 2026-10-19T19:26:54.47293161Z running
|
||||
@@ -0,0 +1 @@
|
||||
PASS: lab2 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,22 @@
|
||||
test_concurrency_100_messages_10_clients (test_api.ApiTests.test_concurrency_100_messages_10_clients) ... ok
|
||||
test_duplicate_username (test_api.ApiTests.test_duplicate_username) ... ok
|
||||
test_empty_message (test_api.ApiTests.test_empty_message) ... ok
|
||||
test_foreign_chat (test_api.ApiTests.test_foreign_chat) ... ok
|
||||
test_malformed_json (test_api.ApiTests.test_malformed_json) ... ok
|
||||
test_multiple_pages_and_cursor_scope (test_api.ApiTests.test_multiple_pages_and_cursor_scope) ... ok
|
||||
test_validation_and_auth (test_api.ApiTests.test_validation_and_auth) ... ok
|
||||
test_chat_rollback_after_unknown_member (test_grade4.Grade4Tests.test_chat_rollback_after_unknown_member) ... ok
|
||||
test_equal_timestamp_pages (test_grade4.Grade4Tests.test_equal_timestamp_pages) ... ok
|
||||
test_login_logout_and_legacy_header (test_grade4.Grade4Tests.test_login_logout_and_legacy_header) ... ok
|
||||
test_nul_in_persisted_fields_returns_400 (test_grade4.Grade4Tests.test_nul_in_persisted_fields_returns_400) ... ok
|
||||
test_registration_race (test_grade4.Grade4Tests.test_registration_race) ... ok
|
||||
test_unicode_password_with_colon_and_hash (test_grade4.Grade4Tests.test_unicode_password_with_colon_and_hash) ... ok
|
||||
test_cursor_requires_complete_utc_datetime (test_pagination.PaginationTests.test_cursor_requires_complete_utc_datetime) ... ok
|
||||
test_cursor_round_trip_and_scope (test_pagination.PaginationTests.test_cursor_round_trip_and_scope) ... ok
|
||||
test_invalid_limits_and_cursors (test_pagination.PaginationTests.test_invalid_limits_and_cursors) ... ok
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Ran 16 tests in 5.023s
|
||||
|
||||
OK
|
||||
PASS: 10 clients; 100 POST; 100 unique messages; IDs/text match
|
||||
Reference in New Issue
Block a user