[TEST] take into account when master node is stopped

This commit is contained in:
Areek Zillur 2015-07-16 23:59:54 -04:00
parent b1e3914461
commit 98fd8d94fe
1 changed files with 2 additions and 3 deletions

View File

@ -22,6 +22,7 @@ package org.elasticsearch.action.admin.indices.segments;
import com.carrotsearch.hppc.cursors.IntObjectCursor;
import com.carrotsearch.hppc.cursors.ObjectCursor;
import com.carrotsearch.randomizedtesting.annotations.Seed;
import com.google.common.base.Predicate;
import org.apache.lucene.index.CorruptIndexException;
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresResponse;
@ -58,7 +59,6 @@ public class IndicesShardStoreRequestTests extends ElasticsearchIntegrationTest
}
@Test
@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/12304")
public void testBasic() throws Exception {
String index = "test";
internalCluster().ensureAtLeastNumDataNodes(2);
@ -92,11 +92,10 @@ public class IndicesShardStoreRequestTests extends ElasticsearchIntegrationTest
disableAllocation(index);
logger.info("--> stop random node");
internalCluster().stopRandomNode(new IndexNodePredicate(index));
List<ShardRouting> unassignedShards = clusterService().state().routingTable().index(index).shardsWithState(ShardRoutingState.UNASSIGNED);
response = client().admin().indices().shardStores(Requests.indicesShardStoresRequest(index)).get();
assertThat(response.getStoreStatuses().containsKey(index), equalTo(true));
ImmutableOpenIntMap<List<IndicesShardStoresResponse.StoreStatus>> shardStoresStatuses = response.getStoreStatuses().get(index);
assertThat(shardStoresStatuses.size(), equalTo(unassignedShards.size()));
assertThat(shardStoresStatuses.size(), greaterThan(0));
for (IntObjectCursor<List<IndicesShardStoresResponse.StoreStatus>> storesStatus : shardStoresStatuses) {
assertThat("must report for one store", storesStatus.value.size(), equalTo(1));
assertThat("reported store should be primary", storesStatus.value.get(0).getAllocation(), equalTo(IndicesShardStoresResponse.StoreStatus.Allocation.PRIMARY));