Repository navigation
Deflake private access account-switch test - #44
Merged
Merged
Conversation
AnkiquestPollWorker queued by an earlier test's present() runs on Dispatchers.Default and can read settings through the next test's switching mock first. Scope the switch to the coroutine under test and assert it fired, instead of returning a fixed snapshot to every read.
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.
account changes never send new server credentials to the captured serverfailed once on ubuntu (run 36316374916) withUnknownHostException: private.example.test.Cause: the previous test's
runFromSettings→present→AnkiquestWidget.requestUpdate(app)queuesAnkiquestPollWorker.Ankiquest.appis left over from an earlier test, and the worker is aCoroutineWorker, so it runs onDispatchers.Defaultand can outlive that test. ItsdashboardUrl()/AnkiquestAvatars.account()read.allthrough the next test's switching mock, so the server switches beforeprofile()reads it.9fc9f2c made this deterministic by returning a snapshot to every read. That also let a second read inside
endpoint()see the old server, which weakens the test.ThreadLocalcontext element that followswithContext(Dispatchers.IO)). Other readers see live prefs without switching.