-
Couldn't load subscription status.
- Fork 2.3k
Fixed a flaky test that is order dependent #19762
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
base: main
Are you sure you want to change the base?
Conversation
…uguoqingfz@gmail.com> Fixed a flaky test that is order dependent Signed-off-by: Joe Liu <liuguoqingfz@gmail.com> Signed-off-by: Joe Liu <guoqing4@illinois.edu>
c3707dc to
c964095
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #19762 +/- ##
============================================
- Coverage 73.19% 73.17% -0.03%
+ Complexity 70946 70924 -22
============================================
Files 5735 5735
Lines 324654 324654
Branches 46962 46962
============================================
- Hits 237643 237556 -87
- Misses 67875 67906 +31
- Partials 19136 19192 +56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| // Ensure test1 primaries are placed before adding other indices (prevents starvation) | ||
| assertBusy(() -> { | ||
| ClusterState s = client().admin().cluster().prepareState().get().getState(); | ||
| int primariesStarted = 0, unassigned = 0; | ||
| for (IndexRoutingTable irt : s.getRoutingTable()) { | ||
| if (irt.getIndex().getName().equals("test1")) { | ||
| for (IndexShardRoutingTable isrt : irt) { | ||
| for (ShardRouting sr : isrt) { | ||
| if (sr.primary() && sr.started()) primariesStarted++; | ||
| if (sr.unassigned()) unassigned++; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| assertEquals(3, primariesStarted); // 3 primaries started | ||
| assertEquals(3, unassigned); // 3 unassigned (the replicas) | ||
| }); |
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.
Can you replace this with a call to the ensureYellow("test1") helper method in the parent test class? The index should be red until all primaries are assigned, and will be yellow if replicas are unassigned.
Description
Allocation is concurrent and order-dependent. Sometimes test2/test3 fill up node capacity (the 6-shards-per-node cap) before all three test1 primaries get a slot. Then one test1 primary stays unassigned too, and you see 16 (or even 14) assigned instead of 17.
Related Issues
Resolves #19726
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.