diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java index 8b4be86a6f206..d3105dfb7f734 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java @@ -539,6 +539,14 @@ public void testUnresponsiveLeaderDetectedEventually() { + defaultMillis(PUBLISH_TIMEOUT_SETTING) // there might be a term bump causing another election + DEFAULT_ELECTION_DELAY + // in clusters with 5 nodes the chances of concurrent elections + // increase, meaning that it takes longer to get a leader elected + // so we should take into account those cases to ensure that the + // cluster stabilises over time. See #63918 for a really messy scenario. + + DEFAULT_ELECTION_DELAY + // additionally take into account that publications might take longer + // until the new leader detects that the old leader is unresponsive + + defaultMillis(PUBLISH_TIMEOUT_SETTING) // then wait for both of: + Math.max(