Repository navigation
fix: reject events for deleted in-memory sessions #1698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -149,6 +149,20 @@ public void lifecycle_deleteSession() { | |
| .isNull(); | ||
| } | ||
|
|
||
| @Test | ||
| public void appendEvent_rejectsDeletedSession() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also cover a user who still has another session. Deleting the only session removes the whole app entry, so this test never reaches the |
||
| InMemorySessionService sessionService = new InMemorySessionService(); | ||
| Session session = | ||
| sessionService.createSession("app", "user", new HashMap<>(), "session1").blockingGet(); | ||
| sessionService.deleteSession("app", "user", "session1").blockingAwait(); | ||
|
|
||
| sessionService | ||
| .appendEvent(session, Event.builder().build()) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider giving this event an app-scoped state delta ( |
||
| .test() | ||
| .assertError(SessionNotFoundException.class); | ||
| assertThat(sessionService.listSessions("app", "user").blockingGet().sessions()).isEmpty(); | ||
| } | ||
|
|
||
| @Test | ||
| public void appendEvent_updatesSessionState() { | ||
| InMemorySessionService sessionService = new InMemorySessionService(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave the session id out of this message, e.g. just "Session not found". Session ids can come from the caller, and we keep caller-supplied values out of exception messages.