Skip to content
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

Fixes: the unit test failures after coroutine version update #18589

Conversation

AjeshRPai
Copy link
Contributor

@AjeshRPai AjeshRPai commented Jun 8, 2023

Fixes

Fixes the failure of the unit tests after the coroutines library update. PR - #18500

On Kotlin coroutines library version 1.6.4

If the coroutine inside a function throws an exception, the test passes, and the exception is thrown silently to the console. In some cases, if the test is asserting a return value and there is a side effect function that throws an exception, then the test still passes.

On Kotlin coroutines library version 1.7.1

The exceptions inside the production code will be thrown, regardless of whether the test is passing, making the unit tests fail.

More details in this thread - Kotlin/kotlinx.coroutines#1205

To test:

  1. Run the unit tests changed in this PR on another branch with coroutines version 1.6.4
  2. Verify tests are failing
  3. Run the unit tests in this PR
  4. Verify tests are passing

Regression Notes

  1. Potential unintended areas of impact
    Incorrect unit test logic

  2. What I did to test those areas of impact (or what existing automated tests I relied on)
    N/A

  3. What automated tests I added (or what prevented me from doing so)
    N/A

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

UI Changes testing checklist:

  • Portrait and landscape orientations.
  • Light and dark modes.
  • Fonts: Larger, smaller and bold text.
  • High contrast.
  • Talkback.
  • Languages with large words or with letters/accents not frequently used in English.
  • Right-to-left languages. (Even if translation isn’t complete, formatting should still respect the right-to-left layout)
  • Large and small screen sizes. (Tablet and smaller phones)
  • Multi-tasking: Split screen and Pop-up view. (Android 10 or higher)

AjeshRPai added 7 commits June 8, 2023 16:37
* Fixes: test failures in UnifiedCommentsEditViewModelTest after
coroutine update
* Fixes: test failures in DomainSuggestionsViewModelTest after
coroutine update
* Fixes: test failures in BackupDownloadViewModelTest after
coroutine update
* Fixes: test failures in QRCodeAuthViewModelTest after
coroutine update
* Fixes: test failures in SiteCreationDomainsViewModelTest after
coroutine update
* Fixes: test failures in SiteCreationProgressViewModelTest after
coroutine update
@AjeshRPai AjeshRPai requested a review from zwarm June 8, 2023 11:26
@AjeshRPai AjeshRPai self-assigned this Jun 8, 2023
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 8, 2023

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr18589-52e140f
Commit52e140f
Direct Downloadwordpress-prototype-build-pr18589-52e140f.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Jun 8, 2023

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr18589-52e140f
Commit52e140f
Direct Downloadjetpack-prototype-build-pr18589-52e140f.apk
Note: Google Login is not supported on these builds.

AjeshRPai added 3 commits June 8, 2023 17:48
* Fixes: test failures in PagesViewModelTest after
coroutine update
* Fixes: test failures in PagesViewModelTest after
coroutine update
@zwarm zwarm changed the title Fixes: the unit test failures after coroutine version udpate Fixes: the unit test failures after coroutine version update Jun 8, 2023
@AjeshRPai AjeshRPai marked this pull request as ready for review June 9, 2023 04:46
@ovitrif ovitrif self-requested a review June 9, 2023 11:33
Copy link
Contributor

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

Thanks for this work and the reason it started: that you felt brave and proved to be right when tackling the Coroutines update work 🙇🏻 !

I found a quickfix for the issue we were having in DomainSuggestionsViewModelTest and suggested a change via a patchfile 👍🏻

Everything else LGTM, but IIRC there were more failing tests at CI time, probably the PR is not fully ready. For that reason (my uncertainty) I didn't approve it just yet 👍🏻

AjeshRPai and others added 2 commits June 9, 2023 18:58
* Fixes: test failures in DomainSuggestionsViewModelTest after
coroutine update
@zwarm
Copy link
Contributor

zwarm commented Jun 12, 2023

@AjeshRPai I'm with Ovi on this one. I pulled this branch and tried the first failing test (as reported by CI) MediaPickerViewModelTest and I can't get it to fail locally. However the ActivityLogViewModelTest do fail locally. 😮‍💨

@ovitrif
Copy link
Contributor

ovitrif commented Jun 13, 2023

@AjeshRPai I'm with Ovi on this one. I pulled this branch and tried the first failing test (as reported by CI) MediaPickerViewModelTest and I can't get it to fail locally. However the ActivityLogViewModelTest do fail locally. 😮‍💨

Hey folks 👋🏻 , Fyi I've started on working to fix these tests yesterday, sharing with you in hope we don't duplicate the same efforts 🙏🏻 !

I've managed to find some small fixes that made all tests in ActivityLogViewModelTest green, I will continue to the next classes.

Mostly doing this to see if the new coroutines version fixes our mutex crash bug (#18589) 😄

…kotlinxCoroutinesVersion-1.7.1-suggestions

Fix failing tests in parent PR #18589
Copy link
Contributor

@ovitrif ovitrif left a comment

Choose a reason for hiding this comment

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

Should be ready when CI passes 🤞🏻

@AjeshRPai AjeshRPai merged commit 1c98deb into dependabot/gradle/kotlinxCoroutinesVersion-1.7.1 Jun 14, 2023
@AjeshRPai AjeshRPai deleted the issue/tests-failures-kotlinxCoroutinesVersion-1.7.1 branch June 14, 2023 07:08
@peril-wordpress-mobile
Copy link

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

@AjeshRPai
Copy link
Contributor Author

Thanks @ovitrif and @zwarm for helping me with this PR 🙌🏼

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.

4 participants