Skip to content

Commit da63abe

Browse files
romtsncodex
andcommitted
test(android): Avoid ANR profiling integration test race
Drive the ANR profiling state-machine test synchronously instead of starting the background polling thread. The previous version could read the queue-backed profile store while the polling thread was still appending stack traces, which made the release unit test flaky with NoSuchElementException in QueueFile iteration. Co-Authored-By: Codex <noreply@openai.com>
1 parent ab5cfac commit da63abe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sentry-android-core/src/test/java/io/sentry/android/core/anr/AnrProfilingIntegrationTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class AnrProfilingIntegrationTest {
174174

175175
val integration = AnrProfilingIntegration()
176176
integration.register(mockScopes, androidOptions)
177-
integration.onForeground()
177+
// Drive the state machine synchronously to avoid racing the background polling thread.
178178

179179
SystemClock.setCurrentTimeMillis(1_000)
180180
integration.checkMainThread(mainThread)

0 commit comments

Comments
 (0)