diff options
Diffstat (limited to 'core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java')
-rw-r--r-- | core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java index 6dd5c3a7b3..61a28897d5 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FailedNodeRoutingTests.java @@ -22,6 +22,7 @@ package org.elasticsearch.cluster.routing.allocation; import org.apache.logging.log4j.Logger; import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.cluster.ESAllocationTestCase; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; import org.elasticsearch.cluster.node.DiscoveryNodes; @@ -31,7 +32,6 @@ import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.decider.ClusterRebalanceAllocationDecider; import org.elasticsearch.common.logging.Loggers; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.cluster.ESAllocationTestCase; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED; @@ -58,19 +58,16 @@ public class FailedNodeRoutingTests extends ESAllocationTestCase { logger.info("start 4 nodes"); clusterState = ClusterState.builder(clusterState).nodes(DiscoveryNodes.builder().add(newNode("node1")).add(newNode("node2")).add(newNode("node3")).add(newNode("node4"))).build(); - RoutingAllocation.Result routingResult = strategy.reroute(clusterState, "reroute"); - clusterState = ClusterState.builder(clusterState).routingResult(routingResult).build(); + clusterState = strategy.reroute(clusterState, "reroute"); logger.info("start all the primary shards, replicas will start initializing"); RoutingNodes routingNodes = clusterState.getRoutingNodes(); - routingResult = strategy.applyStartedShards(clusterState, routingNodes.shardsWithState(INITIALIZING)); - clusterState = ClusterState.builder(clusterState).routingResult(routingResult).build(); + clusterState = strategy.applyStartedShards(clusterState, routingNodes.shardsWithState(INITIALIZING)); routingNodes = clusterState.getRoutingNodes(); logger.info("start the replica shards"); routingNodes = clusterState.getRoutingNodes(); - routingResult = strategy.applyStartedShards(clusterState, routingNodes.shardsWithState(INITIALIZING)); - clusterState = ClusterState.builder(clusterState).routingResult(routingResult).build(); + clusterState = strategy.applyStartedShards(clusterState, routingNodes.shardsWithState(INITIALIZING)); routingNodes = clusterState.getRoutingNodes(); assertThat(routingNodes.node("node1").numberOfShardsWithState(STARTED), equalTo(1)); @@ -86,8 +83,7 @@ public class FailedNodeRoutingTests extends ESAllocationTestCase { .remove(clusterState.routingTable().index("test2").shard(0).primaryShard().currentNodeId()) ) .build(); - routingResult = strategy.deassociateDeadNodes(clusterState, true, "reroute"); - clusterState = ClusterState.builder(clusterState).routingResult(routingResult).build(); + clusterState = strategy.deassociateDeadNodes(clusterState, true, "reroute"); routingNodes = clusterState.getRoutingNodes(); for (RoutingNode routingNode : routingNodes) { |