Skip to content

Commit af75e1c

Browse files
adinauerclaude
andcommitted
fix(test): Fix flaky previous session finalization test
Use awaitility to wait for the previous session file to be deleted instead of asserting immediately. The PreviousSessionFinalizer runs as a separate task after the test's task in the single-threaded executor, so there is a race between the assertion and the file deletion. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 9054d65 commit af75e1c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sentry/src/test/java/io/sentry/SentryTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,9 @@ class SentryTest {
964964
}
965965

966966
await.untilTrue(triggered)
967-
assertFalse(previousSessionFile.exists())
967+
// The PreviousSessionFinalizer runs as a separate task after the test's task in the
968+
// single-threaded executor, so we need to wait for it to delete the file too.
969+
await.until { !previousSessionFile.exists() }
968970
}
969971

970972
@Test

0 commit comments

Comments
 (0)