Skip to content

Commit

Permalink
[TEST] Verify expected number of nodes in cluster before issuing shar…
Browse files Browse the repository at this point in the history
…dStores request
  • Loading branch information
areek authored and rmuir committed Jul 22, 2015
1 parent f0f5a1e commit ad59af4
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.util.concurrent.ExecutionException;

import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoTimeout;
import static org.hamcrest.Matchers.*;

@ElasticsearchIntegrationTest.ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST)
Expand Down Expand Up @@ -91,8 +92,9 @@ public void testBasic() throws Exception {
logger.info("--> disable allocation");
disableAllocation(index);
logger.info("--> stop random node");
int num = client().admin().cluster().prepareState().get().getState().nodes().getSize();
internalCluster().stopRandomNode(new IndexNodePredicate(index));
ensureYellow(index);
assertNoTimeout(client().admin().cluster().prepareHealth().setWaitForNodes("" + (num - 1)));
ClusterState clusterState = client().admin().cluster().prepareState().get().getState();
List<ShardRouting> unassignedShards = clusterState.routingTable().index(index).shardsWithState(ShardRoutingState.UNASSIGNED);
response = client().admin().indices().shardStores(Requests.indicesShardStoresRequest(index)).get();
Expand Down

0 comments on commit ad59af4

Please sign in to comment.