[TEST] [ML] Run ensureStableCluster(...) on all nodes and run synched flush before executing the disrupt

Original commit: elastic/x-pack-elasticsearch@d10beacb73
This commit is contained in:
Martijn van Groningen 2017-04-07 09:51:13 +02:00
parent ee5ab5b1d2
commit b248b6dbfc
1 changed files with 12 additions and 5 deletions

View File

@ -44,13 +44,13 @@ public class MlDistributedFailureIT extends BaseMlIntegTestCase {
public void testFailOver() throws Exception {
internalCluster().ensureAtLeastNumDataNodes(3);
ensureStableCluster(3);
ensureStableClusterOnAllNodes(3);
run(() -> {
GetJobsStatsAction.Request request = new GetJobsStatsAction.Request("job_id");
GetJobsStatsAction.Response response = client().execute(GetJobsStatsAction.INSTANCE, request).actionGet();
DiscoveryNode discoveryNode = response.getResponse().results().get(0).getNode();
internalCluster().stopRandomNode(settings -> discoveryNode.getName().equals(settings.get("node.name")));
ensureStableCluster(2);
ensureStableClusterOnAllNodes(2);
});
}
@ -67,7 +67,7 @@ public class MlDistributedFailureIT extends BaseMlIntegTestCase {
String mlAndDataNode = internalCluster().startNode(Settings.builder()
.put("node.master", false)
.build());
ensureStableCluster(2);
ensureStableClusterOnAllNodes(2);
run(() -> {
logger.info("Stopping dedicated master node");
internalCluster().stopRandomNode(settings -> settings.getAsBoolean("node.master", false));
@ -82,13 +82,13 @@ public class MlDistributedFailureIT extends BaseMlIntegTestCase {
.put("node.data", false)
.put("node.ml", false)
.build());
ensureStableCluster(2);
ensureStableClusterOnAllNodes(2);
});
}
public void testFullClusterRestart() throws Exception {
internalCluster().ensureAtLeastNumDataNodes(3);
ensureStableCluster(3);
ensureStableClusterOnAllNodes(3);
run(() -> {
logger.info("Restarting all nodes");
internalCluster().fullRestart();
@ -131,6 +131,7 @@ public class MlDistributedFailureIT extends BaseMlIntegTestCase {
assertEquals(numDocs1, dataCounts.getProcessedRecordCount());
assertEquals(0L, dataCounts.getOutOfOrderTimeStampCount());
});
client().admin().indices().prepareSyncedFlush().get();
disrupt.run();
assertBusy(() -> {
@ -186,4 +187,10 @@ public class MlDistributedFailureIT extends BaseMlIntegTestCase {
}
}
private void ensureStableClusterOnAllNodes(int nodeCount) {
for (String nodeName : internalCluster().getNodeNames()) {
ensureStableCluster(nodeCount, nodeName);
}
}
}