Keep logout revocations until
Skeleton contracts / contracts (pull_request) Canceled after 0s

written to Redis
This commit is contained in:
2026-10-10 00:47:27 +03:00
parent dc5abb6fff
commit ee6e40cc4e
15 changed files with 341 additions and 26 deletions
+16 -14
View File
@@ -1,7 +1,7 @@
# ./gradlew test (Testcontainers: postgres:17.6-alpine3.22, redis:8.4.0-alpine)
total: 56 tests, 0 failed
total: 58 tests, 0 failed
infrastructure.controllers.authentication.AuthenticationControllerTest: 9 tests, 0 failed, 7.771 s
infrastructure.controllers.authentication.AuthenticationControllerTest: 9 tests, 0 failed, 4.301 s
- logout revokes only the current token
- Bearer token cannot open a session
- password containing a colon and non-ASCII characters works
@@ -11,19 +11,19 @@ infrastructure.controllers.authentication.AuthenticationControllerTest: 9 tests,
- valid Basic credentials open a session
- missing or malformed Basic header returns 401
- wrong password and unknown user get the same 401
infrastructure.controllers.chat.ChatControllerTest: 6 tests, 0 failed, 2.042 s
infrastructure.controllers.chat.ChatControllerTest: 6 tests, 0 failed, 2.154 s
- member can read own chat and members keep their order
- unknown member is rejected before anything is written
- foreign chat returns 404 for non-member
- cursor issued to another user is rejected
- chat list contains only own chats and is paginated
- invalid member lists are rejected with 400
infrastructure.controllers.health.HealthControllerTest: 2 tests, 0 failed, 0.128 s
infrastructure.controllers.health.HealthControllerTest: 2 tests, 0 failed, 0.125 s
- live returns 200
- ready returns 200 when database is reachable
infrastructure.controllers.message.MessageConcurrencyTest: 1 tests, 0 failed, 0.281 s
infrastructure.controllers.message.MessageConcurrencyTest: 1 tests, 0 failed, 0.308 s
- parallel senders produce exactly N unique messages
infrastructure.controllers.message.MessageControllerTest: 7 tests, 0 failed, 1.864 s
infrastructure.controllers.message.MessageControllerTest: 7 tests, 0 failed, 1.846 s
- foreign chat returns 404 when sending
- last page has null next_cursor
- pagination walks all messages exactly once
@@ -31,7 +31,7 @@ infrastructure.controllers.message.MessageControllerTest: 7 tests, 0 failed, 1.8
- empty text returns 400 invalid_request
- history that is an exact multiple of limit ends with null next_cursor
- foreign cursor returns 400
infrastructure.controllers.user.UserControllerTest: 11 tests, 0 failed, 1.7 s
infrastructure.controllers.user.UserControllerTest: 11 tests, 0 failed, 1.861 s
- password shorter than 12 code points returns 400
- concurrent registrations of one username create exactly one user
- X-User-Id alone gives no access
@@ -43,30 +43,32 @@ infrastructure.controllers.user.UserControllerTest: 11 tests, 0 failed, 1.7 s
- Basic credentials are rejected on business endpoints
- me returns the session owner
- X-User-Id does not override bearer identity
infrastructure.repositories.authentication.session.cache.RedisSessionCacheRepositoryTest: 3 tests, 0 failed, 0.1 s
infrastructure.repositories.authentication.session.cache.RedisSessionCacheRepositoryTest: 3 tests, 0 failed, 0.141 s
- cached session round-trips and expires together with the session
- revoke replaces a cached session with a tombstone
- late cache fill cannot overwrite a tombstone
infrastructure.repositories.chat.ExposedChatRepositoryTest: 2 tests, 0 failed, 0.529 s
infrastructure.repositories.chat.ExposedChatRepositoryTest: 2 tests, 0 failed, 0.479 s
- chat row is rolled back when inserting members fails
- successful creation commits the chat and every member
infrastructure.services.authentication.SessionLookupSingleFlightTest: 4 tests, 0 failed, 1.107 s
infrastructure.services.authentication.SessionLookupSingleFlightTest: 4 tests, 0 failed, 1.102 s
- request arriving after logout does not join a lookup started before it
- without single-flight every concurrent miss queries the database
- with single-flight concurrent misses share one database lookup
- lookup that finished before a request arrived is not reused
infrastructure.services.hashing.DefaultHashingServiceTest: 4 tests, 0 failed, 0.425 s
infrastructure.services.hashing.DefaultHashingServiceTest: 4 tests, 0 failed, 0.426 s
- passwords differing only after 72 bytes are distinguished
- validates the right password and rejects a wrong one
- malformed hash is rejected instead of throwing
- hash is a salted Argon2id PHC string
plugins.DatabaseMigrationTest: 1 tests, 0 failed, 0.206 s
plugins.DatabaseMigrationTest: 1 tests, 0 failed, 0.182 s
- re-running migrations applies nothing and keeps data
plugins.DependencyFailureTest: 3 tests, 0 failed, 8.502 s
plugins.DependencyFailureTest: 5 tests, 0 failed, 25.189 s
- without PostgreSQL requests fail with a bounded 503
- logout during a Redis outage survives an API restart
- logout during a Redis outage is not undone by a stale cached copy
- without Redis requests bypass the cache
- hanging Redis costs one command timeout and recovers
plugins.SessionCacheTest: 3 tests, 0 failed, 0.963 s
plugins.SessionCacheTest: 3 tests, 0 failed, 1.025 s
- emptied cache falls back to PostgreSQL
- first authenticated request fills the cache
- logout leaves a tombstone and the token is rejected
+6
View File
@@ -0,0 +1,6 @@
me: 200
logout (redis paused): 204
redis before restart: {"id":"3aa6c510-992e-45ed-9bb3-61f04e23d
me after api restart: 401
redis after: revoked
mtusi-lab2-api | 2026-10-09T20:53:02.205Z INFO [DefaultDispatcher-worker-1] c.m.m.m.i.s.a.DefaultAuthenticationService - Wrote 1 pending session revocations to the cache