Browse Source

Fix testRetriesOnCorrectSchedule (#98782)

Sometimes this test stops after exactly 1000 election attempts, in which
case we never report the 1000th failure. Fixed by asserting that we do
see a report about the 990th instead.

Closes #98772
David Turner 2 years ago
parent
commit
515729048c

+ 2 - 2
server/src/test/java/org/elasticsearch/cluster/coordination/ElectionSchedulerFactoryTests.java

@@ -68,7 +68,8 @@ public class ElectionSchedulerFactoryTests extends ESTestCase {
                     "retrying master election after [0] failed attempts"
                 )
             );
-            for (int i : new int[] { 10, 20, 1000 }) {
+            for (int i : new int[] { 10, 20, 990 }) {
+                // the test may stop after 1000 attempts, so might not report the 1000th failure; it definitely reports the 990th tho.
                 appender.addExpectation(
                     new MockLogAppender.SeenEventExpectation(
                         i + " retries message",
@@ -131,7 +132,6 @@ public class ElectionSchedulerFactoryTests extends ESTestCase {
     }
 
     @TestLogging(reason = "testing logging at INFO level", value = "org.elasticsearch.cluster.coordination.ElectionSchedulerFactory:INFO")
-    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/98772")
     public void testRetriesOnCorrectSchedule() {
         final Builder settingsBuilder = Settings.builder();