Browse Source

Allow extra time for a warning to be logged (#43597)

Today we assert that a warning is logged after no more than
`discovery.cluster_formation_warning_timeout`, but the deterministic scheduler
adds a small amount of extra randomness to the timing of future events, causing
the following build to fail:

    ./gradlew :server:test --tests "org.elasticsearch.cluster.coordination.CoordinatorTests.testLogsWarningPeriodicallyIfClusterNotFormed" -Dtests.seed=DF35C28D4FA9EE2D

This commit adds an allowance for this extra time.
David Turner 6 years ago
parent
commit
f130695812

+ 1 - 1
server/src/test/java/org/elasticsearch/cluster/coordination/CoordinatorTests.java

@@ -1208,7 +1208,7 @@ public class CoordinatorTests extends AbstractCoordinatorTestCase {
                             equalTo(cluster.clusterNodes.stream().map(ClusterNode::getLocalNode).collect(Collectors.toSet())));
                     }
                 });
-                cluster.runFor(warningDelayMillis, "waiting for warning to be emitted");
+                cluster.runFor(warningDelayMillis + DEFAULT_DELAY_VARIABILITY, "waiting for warning to be emitted");
                 mockLogAppender.assertAllExpectationsMatched();
             } finally {
                 mockLogAppender.stop();