-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix Windows unit test failing because of DataStore threading issue #1542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dturner I don't know exactly how many Windows users there are in the wild building this project but I'm pretty sure it's not zero (I'm one of them). It'd great to fix unit tests for them :) |
It is definitely not zero. I am one of the developers using Windows to build this project. : ) |
41a4bb4
to
45b0c2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...t/kotlin/com/google/samples/apps/nowinandroid/core/datastore/NiaPreferencesDataSourceTest.kt
Show resolved
Hide resolved
@dturner PTAL 🙏 |
I'll fix the badging issue in another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this. In memory datastore should also result in faster tests 👍
This PR fixes issues on Windows environments, where DataStore threading is known to be buggy.
A fix has been awaited for months now, but still remains...
Replacing the default DataStore implementation with an in-memory fake avoids having to deal with file synchronization that lead to the issue.
Here is an example of such errors that appears on Windows env:
It fixes both of these issues that can be closed:
Here is a before/after (red/green) on a Windows env in GHA: