-
Notifications
You must be signed in to change notification settings - Fork 110
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
Fix test flakiness by warming up molecule tests #1226
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## develop #1226 +/- ##
========================================
Coverage 57.59% 57.59%
========================================
Files 1067 1067
Lines 27700 27700
Branches 5716 5716
========================================
Hits 15955 15955
Misses 9259 9259
Partials 2486 2486 ☔ View full report in Codecov by Sentry. |
e8014f2
to
4fc995c
Compare
4fc995c
to
07a2fd0
Compare
Kudos, SonarCloud Quality Gate passed! |
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.
LGTM, it's great that it doesn't affect CI times either!
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 looking at this.
In the spirit of point 3 of https://github.com/vector-im/element-x-android/blob/develop/docs/continuous_integration.md#rules :)
Isn't this actually running the warm up before every test of the test class? |
On a side note, sine it's been repeated lots of times:
Could be shortened as:
|
Yes it should work as a class rule although I haven't tested this. Once warmed up the rule adds negligible overhead but perhaps we could still incrementally update these? |
Followed up with: #1310 |
Type of change
Content
Reduce test flakiness by warming up molecule tests. Add a test rule that pre-runs a no-op molecule test and apply it to any presenter tests that use molecule.
Motivation and context
Through profiling, I found that the first test of every test class takes a significant time to run. It turns out that molecule takes a significant amount of time to initialise when running in the first test of any given test class. This can create flakiness as tests will randomly exceed the default timeout of
runTest
(10 seconds).To remove this source of flakiness, this solution ensures that the first call to initialise
moleculeFlow
occurs in a way that isn't impacted by the short default timeout.Related issues:
runTest
default timeout Kotlin/kotlinx.coroutines#3800Screenshots / GIFs
N/A
Tests
N/A
Tested devices
Checklist