Browse Source

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

Simon Willnauer 11 years ago
parent
commit
e3a09e1933

+ 7 - 9
src/test/java/org/elasticsearch/gateway/local/SimpleRecoveryLocalGatewayTests.java

@@ -346,18 +346,17 @@ public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTes
     @Test
     @Slow
     public void testReusePeerRecovery() throws Exception {
-        ImmutableSettings.Builder settings = settingsBuilder()
+        final Settings settings = settingsBuilder()
                 .put("action.admin.cluster.node.shutdown.delay", "10ms")
                 .put(MockFSDirectoryService.CHECK_INDEX_ON_CLOSE, false)
                 .put("gateway.recover_after_nodes", 4)
-                .put(MockDirectoryHelper.CRASH_INDEX, false)
-                // 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();
+                .put(MockDirectoryHelper.CRASH_INDEX, false).build();
 
+        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");
         for (int i = 0; i < 1000; i++) {
             client().prepareIndex("test", "type").setSource("field", "value").execute().actionGet();
@@ -381,7 +380,6 @@ public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTes
 
         logger.info("Running Cluster Health");
         ensureGreen();
-
         logger.info("--> shutting down the nodes");
         // Disable allocations while we are closing nodes
         client().admin().cluster().prepareUpdateSettings()