Fix flaky AnkiDroidJsAPITest on Windows CI#1
Open
kevs-mist wants to merge 1 commit intofix/jsapi-test-flaky-windows-timeoutfrom
Open
Fix flaky AnkiDroidJsAPITest on Windows CI#1kevs-mist wants to merge 1 commit intofix/jsapi-test-flaky-windows-timeoutfrom
kevs-mist wants to merge 1 commit intofix/jsapi-test-flaky-windows-timeoutfrom
Conversation
- Add an explicit 5-minute timeout to all runTest calls to prevent UncompletedCoroutinesError on slow Windows runners, where startReviewer() and advanceRobolectricLooper() consume most of the default 1-minute budget - Fix ankiJsUiTest silently not running due to @OverRide instead of @test Fixes ankidroid#20377."
Owner
Author
|
Please review the text and inform me if any changes are needed. If no changes are required, please allow me to commit. |
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.
Purpose / Description
AnkiDroidJsAPITestflakes on Windows CI withUncompletedCoroutinesError: After waiting for 1m, the test body did not run to completion. On slow Windows runners,startReviewer()andadvanceRobolectricLooper()consume most of the default 1-minuterunTestbudget before any assertions run, causing sporadic timeouts.Fixes
Approach
5.minutestimeout constant (TEST_TIMEOUT) to allrunTestcalls in the class, giving adequate headroom on slow CI runners while still catching genuine hangsankiJsUiTestwhich was annotated with@overrideinstead of@Test, causing it to be silently skipped by JUnit and never actually runHow Has This Been Tested?
Verified locally that
TEST_TIMEOUTis present in the file. The flake is infrastructure-dependent (Windows CI runner slowness) so cannot be fully reproduced locally, but the fix directly addresses the timeout budget issue identified in the CI logs.Learning
The default
runTesttimeout of 1 minute is documented inkotlinx.coroutines.test— it is intentionally tight for unit tests but insufficient for Robolectric tests that spin up a fullRevieweractivity. See [kotlinx.coroutines TestBuilders docs](https://kotlinx.github.io/kotlinx.coroutines/kotlinx-coroutines-test/kotlinx.coroutines.test/run-test.html).Checklist: