diff options
Diffstat (limited to 'core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteTests.java')
-rw-r--r-- | core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteTests.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteTests.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteTests.java index 58ea503529..f13e848ae7 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteTests.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/reroute/ClusterRerouteTests.java @@ -21,6 +21,7 @@ package org.elasticsearch.action.admin.cluster.reroute; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.cluster.ClusterState; +import org.elasticsearch.cluster.ESAllocationTestCase; import org.elasticsearch.cluster.EmptyClusterInfoService; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.cluster.metadata.MetaData; @@ -28,7 +29,6 @@ import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RoutingTable; import org.elasticsearch.cluster.routing.allocation.AllocationService; import org.elasticsearch.cluster.routing.allocation.FailedRerouteAllocation; -import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator; import org.elasticsearch.cluster.routing.allocation.command.AllocateEmptyPrimaryAllocationCommand; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; @@ -41,7 +41,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.network.NetworkModule; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; -import org.elasticsearch.cluster.ESAllocationTestCase; import org.elasticsearch.test.gateway.NoopGatewayAllocator; import java.io.IOException; @@ -51,6 +50,8 @@ import java.util.concurrent.atomic.AtomicReference; import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING; import static org.elasticsearch.cluster.routing.ShardRoutingState.UNASSIGNED; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.not; public class ClusterRerouteTests extends ESAllocationTestCase { @@ -121,9 +122,9 @@ public class ClusterRerouteTests extends ESAllocationTestCase { List<FailedRerouteAllocation.FailedShard> failedShards = Collections.singletonList( new FailedRerouteAllocation.FailedShard(routingTable.index("idx").shard(0).shards().get(0), "boom" + i, new UnsupportedOperationException())); - RoutingAllocation.Result result = allocationService.applyFailedShards(clusterState, failedShards); - assertTrue(result.changed()); - clusterState = ClusterState.builder(clusterState).routingTable(result.routingTable()).build(); + newState = allocationService.applyFailedShards(clusterState, failedShards); + assertThat(newState, not(equalTo(clusterState))); + clusterState = newState; routingTable = clusterState.routingTable(); assertEquals(routingTable.index("idx").shards().size(), 1); if (i == retries-1) { |