Skip to content

Fixes the flaky UncompletedCoroutinesError in AnkiDroidJsAPITest specifically on Windows CI runners.#20442

Closed
Mahakbajpai wants to merge 1 commit intoankidroid:mainfrom
Mahakbajpai:fix/windows-ci-timeout
Closed

Fixes the flaky UncompletedCoroutinesError in AnkiDroidJsAPITest specifically on Windows CI runners.#20442
Mahakbajpai wants to merge 1 commit intoankidroid:mainfrom
Mahakbajpai:fix/windows-ci-timeout

Conversation

@Mahakbajpai
Copy link

@Mahakbajpai Mahakbajpai commented Mar 11, 2026

Purpose / Description

Fixes flaky Windows CI tests in AnkiDroidJsAPITest caused by a 60-second coroutine timeout. Robolectric execution on Windows runners occasionally experiences synchronization overhead that exceeds the default runTest limit.

Fixes

Approach

Instead of a global timeout increase, I have applied a targeted timeout specifically to the ankiGetNoteTagsTest function using runTest(timeout = 2.minutes) (or the specific syntax required by the library version). This addresses the environmental slowness on Windows without masking potential performance regressions in other parts of the test suite.

How Has This Been Tested?

Ran the specific test locally to ensure the syntax is correct and the test passes:
./gradlew :AnkiDroid:testPlayDebugUnitTest --tests "com.ichi2.anki.AnkiDroidJsAPITest"

Learning (optional, can help others)

Found that while runTest has a 60s default, Robolectric on Windows can be significantly slower than on Linux/macOS. By using a targeted timeout instead of a global one in AnkiTest.kt, we maintain the project's performance standards while ensuring CI stability.

Checklist

[x] You have a descriptive commit message with a short title (first line, max 50 chars).

[x] You have commented your code, particularly in hard-to-understand areas

[x] You have performed a self-review of your own code

[ ] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)

[ ] UI Changes: You have tested your change using the Google Accessibility Scanner

@david-allison
Copy link
Member

david-allison commented Mar 11, 2026

The test shouldn't take a minute to execute.

We should understand why it took so long.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows tests are flaky

2 participants