forked from mtusi2026/mtusi2026lab2
исправление замечаний
This commit is contained in:
+2
-2
@@ -1,8 +1,8 @@
|
||||
docker compose --profile ttl up -d --wait api-short-ttl
|
||||
Container mtusi-lab2-valkey-1 Running
|
||||
Container mtusi-lab2-postgres-1 Running
|
||||
Container mtusi-lab2-api-short-ttl-1 Creating
|
||||
Container mtusi-lab2-api-short-ttl-1 Created
|
||||
Container mtusi-lab2-api-short-ttl-1 Recreate
|
||||
Container mtusi-lab2-api-short-ttl-1 Recreated
|
||||
Container mtusi-lab2-postgres-1 Waiting
|
||||
Container mtusi-lab2-valkey-1 Waiting
|
||||
Container mtusi-lab2-valkey-1 Healthy
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
python student-tests/cache_revocation.py
|
||||
pausing valkey (docker compose pause valkey): данные в кэше сохраняются
|
||||
во время паузы: logout -> 204, тот же токен -> 401
|
||||
unpausing valkey
|
||||
после unpause: 23 проверок за 12 с, отозванный токен всегда 401 (и GET, и POST)
|
||||
действующие токены других пользователей работают
|
||||
PASS: revoked session stays revoked after Valkey comes back with stale data
|
||||
@@ -5,7 +5,7 @@ existing token: GET /users/me -> 200 (4015 ms), сессия проверена
|
||||
POST message -> 201, история читается
|
||||
register + login new user -> 201
|
||||
logout -> 204, затем тот же токен -> 401 (отзыв записан в PostgreSQL)
|
||||
10 x GET /users/me без кэша: max 16 ms (кэш не ждём на каждом запросе)
|
||||
10 x GET /users/me без кэша: max 32 ms (кэш не ждём на каждом запросе)
|
||||
через 6 с, ещё 10 x GET /users/me: max 31 ms (повторные попытки — в фоне)
|
||||
starting valkey again
|
||||
after recovery: прежний токен работает, подтверждённые сообщения на месте
|
||||
|
||||
+13
-13
@@ -1,21 +1,21 @@
|
||||
docker compose ps -a --format "table {{.Service}}\t{{.ID}}\t{{.Status}}"
|
||||
SERVICE CONTAINER ID STATUS
|
||||
api 719af7c38c2d Up 41 seconds (healthy)
|
||||
api-short-ttl 047512285fe6 Up 8 hours (healthy)
|
||||
postgres 094d2f567e2e Up 8 hours (healthy)
|
||||
valkey 195f4a7b30f1 Up 7 hours (healthy)
|
||||
api 5d506a14e681 Up About a minute (healthy)
|
||||
api-short-ttl 6e433cfb380a Up 9 seconds (healthy)
|
||||
postgres 094d2f567e2e Up 22 seconds (healthy)
|
||||
valkey 195f4a7b30f1 Up 44 seconds (healthy)
|
||||
python tests/resilience.py --mode persistence --action-script "scripts/restart.cmd" --base-url "http://127.0.0.1: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.
|
||||
|
||||
real 0m12.535s
|
||||
user 0m0.015s
|
||||
sys 0m0.015s
|
||||
real 0m10.093s
|
||||
user 0m0.031s
|
||||
sys 0m0.000s
|
||||
docker compose ps -a --format "table {{.Service}}\t{{.ID}}\t{{.Status}}"
|
||||
SERVICE CONTAINER ID STATUS
|
||||
api 719af7c38c2d Up 3 seconds (health: starting)
|
||||
api-short-ttl 047512285fe6 Up 8 hours (healthy)
|
||||
postgres 094d2f567e2e Up 9 seconds (healthy)
|
||||
valkey 195f4a7b30f1 Up 9 seconds (healthy)
|
||||
api-1 | 2026-10-09 17:57:26,685 INFO messenger.db: Миграции применены: 003_text_as_bytes
|
||||
api-1 | 2026-10-09 17:58:17,783 INFO messenger.db: Миграции: новых нет, схема актуальна
|
||||
api 5d506a14e681 Up 2 seconds (health: starting)
|
||||
api-short-ttl 6e433cfb380a Up 20 seconds (healthy)
|
||||
postgres 094d2f567e2e Up 7 seconds (healthy)
|
||||
valkey 195f4a7b30f1 Up 7 seconds (healthy)
|
||||
api-1 | 2026-10-09 21:17:33,062 INFO messenger.db: Миграции: новых нет, схема актуальна
|
||||
api-1 | 2026-10-09 21:19:16,340 INFO messenger.db: Миграции: новых нет, схема актуальна
|
||||
|
||||
@@ -23,6 +23,6 @@ test_wrong_password_and_unknown_user_look_the_same (test_auth.AuthTest.test_wron
|
||||
test_x_user_id_does_not_change_identity (test_auth.AuthTest.test_x_user_id_does_not_change_identity) ... ok
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Ran 22 tests in 3.300s
|
||||
Ran 22 tests in 2.609s
|
||||
|
||||
OK
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
docker compose exec -T valkey valkey-cli --user health --pass none --no-auth-warning dbsize
|
||||
2
|
||||
5
|
||||
docker compose exec -T valkey valkey-cli --user health --pass none --no-auth-warning info stats | grep -E "keyspace_(hits|misses)"
|
||||
keyspace_hits:14
|
||||
keyspace_hits:16
|
||||
keyspace_misses:2
|
||||
docker compose exec -T valkey valkey-cli --user health --pass none --no-auth-warning get sess:anything
|
||||
NOPERM User health has no permissions to run the 'get' command
|
||||
|
||||
Reference in New Issue
Block a user