瀏覽代碼

Test: testCancelRecoveryAndResume - add network hook before bumping replicas

Boaz Leskes 10 年之前
父節點
當前提交
0f2d2d0495
共有 1 個文件被更改,包括 7 次插入5 次删除
  1. 7 5
      src/test/java/org/elasticsearch/recovery/TruncatedRecoveryTests.java

+ 7 - 5
src/test/java/org/elasticsearch/recovery/TruncatedRecoveryTests.java

@@ -109,11 +109,6 @@ public class TruncatedRecoveryTests extends ElasticsearchIntegrationTest {
         client().admin().indices().prepareFlush().setForce(true).setWaitIfOngoing(true).get();
         client().admin().indices().prepareOptimize().setMaxNumSegments(1).setFlush(true).get();
 
-        logger.info("--> bumping replicas to 1"); //
-        client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder()
-                .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)
-                .put("index.routing.allocation.include._name",  // now allow allocation on all nodes
-                        primariesNode.getNode().name() + "," + unluckyNode.getNode().name())).get();
         final CountDownLatch latch = new CountDownLatch(1);
         final AtomicBoolean truncate = new AtomicBoolean(true);
         for (NodeStats dataNode : dataNodeStats) {
@@ -134,6 +129,13 @@ public class TruncatedRecoveryTests extends ElasticsearchIntegrationTest {
                 }
             });
         }
+
+        logger.info("--> bumping replicas to 1"); //
+        client().admin().indices().prepareUpdateSettings("test").setSettings(settingsBuilder()
+                .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 1)
+                .put("index.routing.allocation.include._name",  // now allow allocation on all nodes
+                        primariesNode.getNode().name() + "," + unluckyNode.getNode().name())).get();
+
         latch.await();
 
         // at this point we got some truncated left overs on the replica on the unlucky node