-
-
Notifications
You must be signed in to change notification settings - Fork 385
Description
Note
The pull request "fix(tests): Fix flaky SentryCrashInstallationReporterTests" was created by @itaybre but did not reference an issue. Therefore this issue was created for better visibility in external tools like Linear.
Description
SentryCrashInstallationReporterTests.testShouldCaptureCrashReportWithLegacyStorageInfo is flaky on CI — all assertions fail with 0 reports processed.
The C-level sentrycrash_install() has a global g_installed guard: if another test class left it at 1, the call returns early without reinitializing the report store (i.e., sentrycrashcrs_initialize is skipped and g_reportsPath stays stale). If that stale path's directory was deleted by a previous test's cleanup, sentrycrashcrs_addUserReport silently fails to write the report file, and allReports returns an empty array.
Changes
- Call
sentrycrash_uninstall()beforesut.install()in test setup — resets the globalg_installedflag sosentrycrash_install()fully reinitializes the report store path. - Reorder
tearDownsosut.uninstall()runs beforeclearTestState()— ensuresuninstalloperates on the original dependency container rather than creating a throwaway one after the container is reset.
Motivation
Fix flaky test: SentryCrashInstallationReporterTests.testShouldCaptureCrashReportWithLegacyStorageInfo
How it was tested
Ran the full test class locally — all 4 tests pass.
#skip-changelog