-
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
Introduce tests sharding #21101
Introduce tests sharding #21101
Conversation
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
Setting `variant` under `configs` doesn't seem to work: runningcode/fladle#60
Copy recursively, as now there'll be multiple xml file reports
As tests between `wordpress` and `jetpack` can differ. A good example is `StatsTests#e2eAllDayStatsLoad` which runs for Jetpack app only.
094a51e
to
6240d49
Compare
Instead of relying on env variable used by previously used Fastlane Firebase action, we'll parse report generated by fladle/flank
6240d49
to
d00c6b6
Compare
to test Buildkite annotations
d00c6b6
to
cd01ef0
Compare
fastlane/lanes/test.rb
Outdated
sh("buildkite-agent annotation remove --context '#{annotation_ctx}' || true") if is_ci? | ||
else | ||
details_url = lane_context[SharedValues::FIREBASE_TEST_MORE_DETAILS_URL] | ||
rescue |
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.
🚫 | Style/RescueStandardError: Avoid rescuing without specifying an error class. |
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.
@iangmaia could you please confirm if it's okay to ignore? I want to rescue from all possible causes of gradle
or sh
crash.
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.
I think those would still be caught if using rescue StandardError
?
rescue | |
rescue StandardError |
By the way, mentioning just in case (not sure if it would make more sense here, as you also have the gradle
call): for sh
, you can also use a error_callback
parameter if you want to do a custom handling in case the command returns an error.
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.
True, rescue StandardError
worked fine, thanks! Addressed in 997e808
About error_callback
- I don't see it being mentioned in gradle
action documentation, and Gradle part is the most crucial part of this handling so I think we could keep this try/catch approach
"every action and every plugin's code runs in the root of the project, while all user code from the Fastfile runs inside the ./fastlane directory." https://docs.fastlane.tools/advanced/fastlane/\#directory-behavior
This should fix annotating test failures.
13176ae
to
cc83564
Compare
This reverts commit 3d7c853.
These tests are ignored anyway during a runtime by `assume` method. This doesn't work well with tests sharding though. In case if one of `e2eAllDayStatsLoad` tests is added on its own to a separate shard, Firebase Test Lab will mark the test suite as failed with message: "Some test executions didn't run any test cases. This is usually caused by aggressive sharding (e.g. more shards than test cases), manual sharding errors, or skipping tests. All executions have overhead time, so these may be billable or may count against your quota. A failure outcome was generated to bring your attention to this."
So the config in `wordpress` can indeed append new exclusions
7f9f125
to
10c9a74
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## trunk #21101 +/- ##
==========================================
- Coverage 40.71% 40.39% -0.33%
==========================================
Files 1530 1515 -15
Lines 70256 69722 -534
Branches 11612 11562 -50
==========================================
- Hits 28606 28165 -441
+ Misses 39065 38990 -75
+ Partials 2585 2567 -18 ☔ View full report in Codecov by Sentry. |
"notClass org.wordpress.android.e2e.StatsTests", | ||
"notClass org.wordpress.android.e2e.StatsGranularTabsTest", |
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.
for test targets unavailable on the variant, do we need to define them here to be excluded?
asking because when looking at the tests, it looks like there's a check to see if it's jetpack app before continuing with test setup:
WordPress-Android/WordPress/src/androidTest/java/org/wordpress/android/e2e/StatsGranularTabsTest.kt
Line 24 in a93b999
assumeTrue(BuildConfig.IS_JETPACK_APP) |
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.
Unfortunately, they have to. If they're not, fladle/flank
might create a shard with only tests from StatsTests
or StatsGranularTabsTest
. As they're ignored, the execution will be very fast (few seconds) and Firebase Test Lab will mark the test run as failed. It will do this to signal a problem, as too aggressive sharding might bring more unwanted costs. Some more details are available in here the comment description: cc4cc3b . Failed run like this can be found here https://buildkite.com/automattic/wordpress-android/builds/19467#01910e2f-5783-4f74-8897-2725f66ce343
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.
I see, thanks for the detailed explanation and linking that commit's comment description! What do you think about adding a comment on the test too? So we would know for a future test that's only available on one variant we should add it to the exclusion list too
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.
Sure thing, added a comment! WDYT?
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.
👋 @wzieba !
I have reviewed this PR and everything LGTM, once again, a really awesome job done here, kudos! 🌟 x 🌟 ^ 🌟
- Thanks for making
fladle
work with a project structure on multiple apps, I am sure it mustn't have been easy! 💯 - Thanks for keeping the Firebase annotation! 🥇
I have left one questions (❓), one suggestions (💡) and one minor (🔍) comment for you to consider. I am going to approve this PR anyway, since none is blocking. I am NOT going to merge this PR yet to give you some time to apply any of my suggestions. However, feel free to ignore them and merge the PR yourself.
To increase readability
… using Fladle/Flank
Quality Gate passedIssues Measures |
Description
This PR implements instrumentation tests sharding using Fladle Gradle Plugin. Comparing to the WooCommerce Android configuration (woocommerce/woocommerce-android#12029) it has some twists:
wordpress
andjetpack
Impact
Duration of execution of instrumented tests
Testing
I've rerun the whole job several times to make sure that tests aren't flaky. We shouldn't expect any difference in tests execution though, as we only distribute tests across few devices, instead of running all of them on a single device.
Demo