Merge branch 'master' into feature/query-refactoring

This commit is contained in:
Christoph Büscher 2015-07-20 12:52:32 +02:00
commit 7540ad5d50
1 changed files with 6 additions and 2 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.cluster.routing.allocation;
import com.carrotsearch.randomizedtesting.annotations.Repeat;
import com.google.common.collect.ImmutableList;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.ClusterState;
@ -371,11 +372,14 @@ public class FailedShardsRoutingTests extends ElasticsearchAllocationTestCase {
logger.info("fail the first shard, will start INITIALIZING on the second node");
prevRoutingTable = routingTable;
final ShardRouting firstShard = clusterState.routingNodes().node("node1").get(0);
final ShardRouting firstShard = clusterState.routingNodes().node(nodeHoldingPrimary).get(0);
routingTable = strategy.applyFailedShard(clusterState, firstShard).routingTable();
clusterState = ClusterState.builder(clusterState).routingTable(routingTable).build();
assertThat(prevRoutingTable != routingTable, equalTo(true));
final String nodeHoldingPrimary2 = routingTable.index("test").shard(0).primaryShard().currentNodeId();
assertThat(nodeHoldingPrimary2, not(equalTo(nodeHoldingPrimary)));
assertThat(routingTable.index("test").shards().size(), equalTo(1));
for (int i = 0; i < routingTable.index("test").shards().size(); i++) {
assertThat(routingTable.index("test").shard(i).size(), equalTo(2));