-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add logging for all known migration errors #17748
Conversation
📲 You can test these changes on WordPress by downloading wordpress-installable-build-pr17748-57cb95f.apk
|
📲 You can test these changes on Jetpack by downloading jetpack-installable-build-pr17748-57cb95f.apk
|
The solution used in this commit is to copy the logging wrapper from fluxc in the unit test source path so that it remains compatible with the copied AppLog class (which is also copied in a similar manner, as a work-around). This prevents build errors when the logging wrapper's mock is verified to have been invoked.
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.
Thank you for your work on this @mkevins 🙇
I tested the following scenarios:
- ✅ (testing steps) Start JP app with WP not logged in → error is logged
- ✅ Create local draft in WP app → migration fall back to login → logged error:
E/WordPress-JETPACK_MIGRATION: Ineligibility(reason=LocalDraftContentIsPresent)
- ✅ Manually emit error during user flags migration → migration error screen → logged error :
E/WordPress-JETPACK_MIGRATION: org.wordpress.android.localcontentmigration.LocalMigrationError$NoUserFlagsFoundError@10cf5a2
The enhanced logging works as expected 👍
PS: Nice solution to mitigate the unit testing issues 😅 🏅
Feel free to merge this if you confirm it's ready
Found 1 violations: The PR caused the following dependency changes:-\--- org.wordpress:utils:{strictly 3.1.0} -> 3.1.0
+\--- org.wordpress:utils:{strictly trunk-1ec18489fc79bb8f10b827586f6efcdf3c13f5b1} -> trunk-1ec18489fc79bb8f10b827586f6efcdf3c13f5b1
Please review and act accordingly
|
Thanks Ovi for testing and reviewing!
Thanks, I was glad to find a solution! |
Fixes #17746
Related PR: wordpress-mobile/WordPress-Utils-Android#119
To test:
Bonus:
Manually cause a failure by emitting an error from a different migration step (e.g. sites)
Expect the error to be logged as well.
Regression Notes
Potential unintended areas of impact
Migration
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual and automated tests (including migration unit tests)
What automated tests I added (or what prevented me from doing so)
Adding tests for
AppLog
andAppLogWrapper
proved to be time-consuming and problematic. TheAppLog
used in unit tests is different from the one used in production (to avoid calls to Android Framework methods), and the wrapper is not resolving correctly, resulting in binary incompatibility. It might be worth improving the architecture of the logging wrapper(s) to make adding tests more ergonomic. Currently, it seems that only mocking is supported, but actually verifying anything on those mocks results in classpath related build errors.Update: I found a solution to the
verify
issue by providing a simple test double forAppLogWrapper
. Usually, a wrapper would allow mocking (and verifying) directly, but this is needed to satisfy the type bindings in the test environment because we are already doing the same forAppLog
(a shared dependency).PR submission checklist:
RELEASE-NOTES.txt
if necessary.