26
26
import org .elasticsearch .action .admin .indices .status .ShardStatus ;
27
27
import org .elasticsearch .cluster .ClusterState ;
28
28
import org .elasticsearch .common .settings .ImmutableSettings ;
29
- import org .elasticsearch .common .unit .TimeValue ;
30
29
import org .elasticsearch .common .xcontent .XContentFactory ;
31
30
import org .elasticsearch .gateway .Gateway ;
32
31
import org .elasticsearch .index .query .FilterBuilders ;
@@ -359,8 +358,12 @@ public void testReusePeerRecovery() throws Exception {
359
358
assertThat (clusterHealth .getStatus (), equalTo (ClusterHealthStatus .GREEN ));
360
359
361
360
logger .info ("--> shutting down the nodes" );
362
- client ("node1" ).admin ().cluster ().prepareNodesShutdown ().setDelay ("10ms" ).setExit (false ).execute ().actionGet ();
363
- assertThat (waitForNodesToShutdown (TimeValue .timeValueSeconds (30 ), "node1" , "node2" , "node3" , "node4" ), equalTo (true ));
361
+ // Disable allocations while we are closing nodes
362
+ client ("node1" ).admin ().cluster ().prepareUpdateSettings ().setTransientSettings (settingsBuilder ().put ("cluster.routing.allocation.disable_allocation" , true )).execute ().actionGet ();
363
+ for (int i = 1 ; i < 5 ; i ++) {
364
+ closeNode ("node" + i );
365
+ }
366
+
364
367
logger .info ("--> start the nodes back up" );
365
368
startNode ("node1" , settings );
366
369
startNode ("node2" , settings );
@@ -374,8 +377,11 @@ public void testReusePeerRecovery() throws Exception {
374
377
assertThat (clusterHealth .getStatus (), equalTo (ClusterHealthStatus .GREEN ));
375
378
376
379
logger .info ("--> shutting down the nodes" );
377
- client ("node1" ).admin ().cluster ().prepareNodesShutdown ().setDelay ("10ms" ).setExit (false ).execute ().actionGet ();
378
- assertThat (waitForNodesToShutdown (TimeValue .timeValueSeconds (30 ), "node1" , "node2" , "node3" , "node4" ), equalTo (true ));
380
+ // Disable allocations while we are closing nodes
381
+ client ("node1" ).admin ().cluster ().prepareUpdateSettings ().setTransientSettings (settingsBuilder ().put ("cluster.routing.allocation.disable_allocation" , true )).execute ().actionGet ();
382
+ for (int i = 1 ; i < 5 ; i ++) {
383
+ closeNode ("node" + i );
384
+ }
379
385
380
386
logger .info ("--> start the nodes back up" );
381
387
startNode ("node1" , settings );
0 commit comments