[TEST] Ensure that all flushes happen on PeerRecovery tests

This commit is contained in:
Simon Willnauer 2014-11-30 12:57:56 +01:00
parent c630b1e8a4
commit ade5aaae5f
1 changed files with 5 additions and 3 deletions

View File

@ -34,7 +34,6 @@ import org.elasticsearch.indices.recovery.RecoveryState;
import org.elasticsearch.test.ElasticsearchIntegrationTest; import org.elasticsearch.test.ElasticsearchIntegrationTest;
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope; import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
import org.elasticsearch.test.InternalTestCluster.RestartCallback; import org.elasticsearch.test.InternalTestCluster.RestartCallback;
import org.elasticsearch.test.junit.annotations.TestLogging;
import org.elasticsearch.test.store.MockDirectoryHelper; import org.elasticsearch.test.store.MockDirectoryHelper;
import org.elasticsearch.test.store.MockFSDirectoryService; import org.elasticsearch.test.store.MockFSDirectoryService;
import org.junit.Test; import org.junit.Test;
@ -363,10 +362,13 @@ public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTes
client().admin().indices().prepareFlush().execute().actionGet(); client().admin().indices().prepareFlush().execute().actionGet();
} }
} }
if (randomBoolean()) {
client().admin().indices().prepareFlush().execute().actionGet(); client().admin().indices().prepareFlush().execute().actionGet();
}
logger.info("Running Cluster Health"); logger.info("Running Cluster Health");
ensureGreen(); ensureGreen();
client().admin().indices().prepareOptimize("test").setWaitForMerge(true).setMaxNumSegments(100).get(); // just wait for merges
client().admin().indices().prepareFlush().setWaitIfOngoing(true).setForce(true).execute().actionGet();
logger.info("--> shutting down the nodes"); logger.info("--> shutting down the nodes");