diff --git a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterAllocationDeciderTests.java b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterAllocationDeciderTests.java index 507ebd53356..5ec162eb719 100644 --- a/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterAllocationDeciderTests.java +++ b/core/src/test/java/org/elasticsearch/cluster/routing/allocation/FilterAllocationDeciderTests.java @@ -28,6 +28,7 @@ import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.routing.RecoverySource; import org.elasticsearch.cluster.routing.RoutingTable; +import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.allocator.BalancedShardsAllocator; import org.elasticsearch.cluster.routing.allocation.decider.AllocationDeciders; import org.elasticsearch.cluster.routing.allocation.decider.Decision; @@ -81,11 +82,17 @@ public class FilterAllocationDeciderTests extends ESAllocationTestCase { state.getRoutingNodes().node("node2"), allocation); assertEquals(Type.YES, decision.type()); assertEquals("node passes include/exclude/require filters", decision.getExplanation()); + ShardRouting primaryShard = routingTable.index("idx").shard(0).primaryShard(); decision = (Decision.Single) filterAllocationDecider.canAllocate( routingTable.index("idx").shard(0).primaryShard(), state.getRoutingNodes().node("node1"), allocation); assertEquals(Type.NO, decision.type()); - assertEquals("initial allocation of the index is only allowed on nodes [_id:\"node2\"]", decision.getExplanation()); + if (primaryShard.recoverySource().getType() == RecoverySource.Type.LOCAL_SHARDS) { + assertEquals("initial allocation of the shrunken index is only allowed on nodes [_id:\"node2\"] that " + + "hold a copy of every shard in the index", decision.getExplanation()); + } else { + assertEquals("initial allocation of the index is only allowed on nodes [_id:\"node2\"]", decision.getExplanation()); + } state = service.reroute(state, "try allocate again"); routingTable = state.routingTable();