Repository navigation
test(core): Allow repeated scopes storage set calls in SentryTest - #6359
Draft
sentry-junior[bot] wants to merge 1 commit into
Draft
sentry-junior[bot] wants to merge 1 commit into
sentry-junior[bot] wants to merge 1 commit into
Conversation
The custom storage mock always returns null from get(), so the BackpressureMonitor health check, scheduled 500ms after init, forks the root scopes and calls set() again. On slow runners that landed before verify and failed the test with TooManyActualInvocations. Co-Authored-By: Nelson Osacky <nelson.osacky@sentry.io>
📲 Install BuildsAndroid
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📜 Description
when scopesStorageFactory is set, it is used instead of default storagenow checksset()withatLeastOnce()instead of exactly once.💡 Motivation and Context
Between Oct 15 and Oct 22, the test failed 6 times with
TooManyActualInvocations: iScopesStorage.set(...). 3 of those runs passed on rerun.The custom storage mock always returns
nullfromget(). That means everySentry.getCurrentScopes()call after init forks the root scopes and callsset()again (Sentry.java:135). I traced the second call locally: it comes from theBackpressureMonitorhealth check, which the executor runs 500ms after init throughSentry.isHealthy(). On a slow runner, that check runs beforeverifydoes.💚 How did you test it?
set()call on the mock with a temporary stack-trace answer and added a 2s sleep after init. The calls came first fromSentry.init, then fromBackpressureMonitor.checkHealthonSentryExecutorServiceThreadFactory-0.:sentry:test --tests io.sentry.SentryTest: all 102 tests pass locally (JDK 21).📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
None.
#skip-changelog
via no.
--
View Junior Session [Sentry]