Skip to content

fix(tests): Fix flaky SentryCrashInstallationReporterTests #7683

@github-actions

Description

@github-actions

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

  1. Call sentrycrash_uninstall() before sut.install() in test setup — resets the global g_installed flag so sentrycrash_install() fully reinitializes the report store path.
  2. Reorder tearDown so sut.uninstall() runs before clearTestState() — ensures uninstall operates 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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions