Skip to content

Fix flaky incoming verification tests #4479

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

Merged
merged 1 commit into from
Mar 26, 2025

Conversation

jmartinesp
Copy link
Member

Content

  • Use a provided dispatchers.io value in IncomingVerificationPresenter, not the default one, so we can provide it in the tests.
  • Make sure we advance the time in the tests so the disposable effect has had time to be applied before the checks.

Motivation and context

We had a couple of flaky tests making the development slower as we had to retry the test job several times.

Tests

If the CI is happy, we're happy.

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@jmartinesp jmartinesp added the PR-Build For changes related to build, tools, CI/CD label Mar 26, 2025
Copy link
Contributor

github-actions bot commented Mar 26, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/8MSyB1

Copy link

codecov bot commented Mar 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.09%. Comparing base (48c7e46) to head (5c0e768).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4479   +/-   ##
========================================
  Coverage    80.09%   80.09%           
========================================
  Files         2081     2081           
  Lines        55550    55550           
  Branches      6785     6785           
========================================
  Hits         44495    44495           
  Misses        8724     8724           
  Partials      2331     2331           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@@ -57,7 +58,7 @@ class IncomingVerificationPresenter @AssistedInject constructor(

@Composable
override fun present(): IncomingVerificationState {
val coroutineScope = rememberCoroutineScope { Dispatchers.IO }
val coroutineScope = rememberCoroutineScope { dispatchers.io }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my understanding, why are we providing a dispatcher here? This is the only presenter using this pattern.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it was done so we could avoid passing the dispatcher in every launch { ... } call instead. Maybe it's just better to remove the whole dispatcher usage, if it doesn't affect the verification flow at all.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to work too, so let's try that as it simplifies everything.

@jmartinesp jmartinesp force-pushed the misc/fix-flaky-incoming-verification-tests branch from 725ba8c to 5c0e768 Compare March 26, 2025 13:47
Copy link

@jmartinesp jmartinesp marked this pull request as ready for review March 26, 2025 14:19
@jmartinesp jmartinesp requested a review from a team as a code owner March 26, 2025 14:19
@jmartinesp jmartinesp requested review from bmarty and removed request for a team March 26, 2025 14:19
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jmartinesp jmartinesp merged commit 9fbe110 into develop Mar 26, 2025
31 checks passed
@jmartinesp jmartinesp deleted the misc/fix-flaky-incoming-verification-tests branch March 26, 2025 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Build For changes related to build, tools, CI/CD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants