fix ci flakiness leaderelection test#4388
Draft
epugh wants to merge 4 commits intoapache:mainfrom
Draft
Conversation
…erElection - Increase cluster.waitForActiveCollection timeout from 10s to 60s - Replace ad-hoc polling loop after expireZkSession with waitForState (waits until leader moves away from the expired-session node) - Replace Thread.sleep with waitForState for node rejoining live nodes - Replace final polling loop + assertEquals with waitForState (waits until original node becomes leader again) Agent-Logs-Url: https://github.com/epugh/solr/sessions/1eab1dea-7bf6-4911-93ff-03f3c6614cfd Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
epugh
commented
May 2, 2026
| createCollection(collection); | ||
|
|
||
| cluster.waitForActiveCollection(collection, 10, TimeUnit.SECONDS, 2, 6); | ||
| cluster.waitForActiveCollection(collection, 60, TimeUnit.SECONDS, 2, 6); |
Contributor
Author
There was a problem hiding this comment.
I believe this is to set an overall upper limit before failing!
|
|
||
| // make sure we have waited long enough for the first leader to have come back | ||
| Thread.sleep(ZkTestServer.TICK_TIME * 2 + 100); | ||
| // Wait until leadership has moved away from the expired-session node |
Contributor
Author
There was a problem hiding this comment.
I like the waitForState instead of the thread.sleep
…nd ZkShardTermsRecoveryTest Agent-Logs-Url: https://github.com/epugh/solr/sessions/e666fe4d-9dd3-4036-90d5-2d08cbdec281 Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
…in LeaderElectionIntegrationTest Agent-Logs-Url: https://github.com/epugh/solr/sessions/e666fe4d-9dd3-4036-90d5-2d08cbdec281 Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I found this while running some tests on Crave:
I asked for a tip from copilot on what was failing, and this is what it gave me. I believe that I've basically seen this same timing fix proposed on other flaky tests..