use of org.elasticsearch.gateway.GatewayAllocator in project elasticsearch by elastic.
the class RareClusterStateIT method testUnassignedShardAndEmptyNodesInRoutingTable.
public void testUnassignedShardAndEmptyNodesInRoutingTable() throws Exception {
internalCluster().startNode();
createIndex("a");
ensureSearchable("a");
ClusterState current = clusterService().state();
GatewayAllocator allocator = internalCluster().getInstance(GatewayAllocator.class);
AllocationDeciders allocationDeciders = new AllocationDeciders(Settings.EMPTY, Collections.emptyList());
RoutingNodes routingNodes = new RoutingNodes(ClusterState.builder(current).routingTable(RoutingTable.builder(current.routingTable()).remove("a").addAsRecovery(current.metaData().index("a")).build()).nodes(DiscoveryNodes.EMPTY_NODES).build(), false);
RoutingAllocation routingAllocation = new RoutingAllocation(allocationDeciders, routingNodes, current, ClusterInfo.EMPTY, System.nanoTime(), false);
allocator.allocateUnassigned(routingAllocation);
}
Aggregations