[TEST] Move rebalance setting to the index level / pass it on index creation

This commit is contained in:
Simon Willnauer 2014-10-29 09:24:35 +01:00
parent b23e6e0593
commit e3a09e1933

View File

@ -346,18 +346,17 @@ public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTes
@Test @Test
@Slow @Slow
public void testReusePeerRecovery() throws Exception { public void testReusePeerRecovery() throws Exception {
ImmutableSettings.Builder settings = settingsBuilder() final Settings settings = settingsBuilder()
.put("action.admin.cluster.node.shutdown.delay", "10ms") .put("action.admin.cluster.node.shutdown.delay", "10ms")
.put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false) .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false)
.put("gateway.recover_after_nodes", 4) .put("gateway.recover_after_nodes", 4)
.put(MockDirectoryHelper.CRASH_INDEX, false) .put(MockDirectoryHelper.CRASH_INDEX, false).build();
// prevent any rebalance actions during the peer recovery
// if we run into a relocation the reuse count will be 0 and this fails the test. We are testing here if
// we reuse the files on disk after full restarts for replicas.
.put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE);
internalCluster().startNodesAsync(4, settings.build()).get();
internalCluster().startNodesAsync(4, settings).get();
// prevent any rebalance actions during the peer recovery
// if we run into a relocation the reuse count will be 0 and this fails the test. We are testing here if
// we reuse the files on disk after full restarts for replicas.
assertAcked(prepareCreate("test").setSettings(ImmutableSettings.builder().put(indexSettings()).put(EnableAllocationDecider.INDEX_ROUTING_REBALANCE_ENABLE, EnableAllocationDecider.Rebalance.NONE)));
logger.info("--> indexing docs"); logger.info("--> indexing docs");
for (int i = 0; i < 1000; i++) { for (int i = 0; i < 1000; i++) {
client().prepareIndex("test", "type").setSource("field", "value").execute().actionGet(); client().prepareIndex("test", "type").setSource("field", "value").execute().actionGet();
@ -381,7 +380,6 @@ public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTes
logger.info("Running Cluster Health"); logger.info("Running Cluster Health");
ensureGreen(); ensureGreen();
logger.info("--> shutting down the nodes"); logger.info("--> shutting down the nodes");
// Disable allocations while we are closing nodes // Disable allocations while we are closing nodes
client().admin().cluster().prepareUpdateSettings() client().admin().cluster().prepareUpdateSettings()