mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 06:16:40 +00:00
Wait longer for leader failure in logs test (#46958)
`testLogsWarningPeriodicallyIfClusterNotFormed` simulates a leader failure and waits for long enough that a failing leader check is scheduled. However it does not wait for the failing check to actually fail, which requires another two actions and therefore might take up to 200ms more. Unlucky timing would result in this test failing, for instance: ./gradle ':server:test' \ --tests "org.elasticsearch.cluster.coordination.CoordinatorTests.testLogsWarningPeriodicallyIfClusterNotFormed" \ -Dtests.jvm.argline="-Dhppc.bitmixer=DETERMINISTIC" \ -Dtests.seed=F18CDD0EBEB5653:E9BC1A8B062E697A This commit adds the extra delay needed for the leader failure to complete as expected. Fixes #46920
This commit is contained in:
parent
363beefbcd
commit
7bc86f23ec
@ -1216,9 +1216,15 @@ public class CoordinatorTests extends AbstractCoordinatorTestCase {
|
|||||||
clusterNode.disconnect();
|
clusterNode.disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
cluster.runFor(defaultMillis(LEADER_CHECK_INTERVAL_SETTING) + defaultMillis(LEADER_CHECK_TIMEOUT_SETTING),
|
cluster.runFor(defaultMillis(LEADER_CHECK_TIMEOUT_SETTING) // to wait for any in-flight check to time out
|
||||||
|
+ defaultMillis(LEADER_CHECK_INTERVAL_SETTING) // to wait for the next check to be sent
|
||||||
|
+ 2 * DEFAULT_DELAY_VARIABILITY, // to send the failing check and receive the disconnection response
|
||||||
"waiting for leader failure");
|
"waiting for leader failure");
|
||||||
|
|
||||||
|
for (final ClusterNode clusterNode : cluster.clusterNodes) {
|
||||||
|
assertThat(clusterNode.getId() + " is CANDIDATE", clusterNode.coordinator.getMode(), is(CANDIDATE));
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = scaledRandomIntBetween(1, 10); i >= 0; i--) {
|
for (int i = scaledRandomIntBetween(1, 10); i >= 0; i--) {
|
||||||
final MockLogAppender mockLogAppender = new MockLogAppender();
|
final MockLogAppender mockLogAppender = new MockLogAppender();
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user