[TEST] ensure that we don't fail if all shards fail due to no replicas and low number of shards

This commit is contained in:
Simon Willnauer 2014-03-23 21:41:41 +01:00
parent 6962d4f948
commit 034ce75250
1 changed files with 7 additions and 0 deletions

View File

@ -24,6 +24,7 @@ import com.carrotsearch.randomizedtesting.annotations.Repeat;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.index.IndexRequestBuilder;
import org.elasticsearch.action.search.SearchPhaseExecutionException;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHits;
@ -110,6 +111,12 @@ public class SearchWhileRelocatingTests extends ElasticsearchIntegrationTest {
// this is the more critical but that we hit the actual hit array has a different size than the
// actual number of hits.
}
} catch (SearchPhaseExecutionException ex) {
// it's possible that all shards fail if we have a small number of shards.
// with replicas this should not happen
if (numberOfReplicas == 1 || !ex.getMessage().contains("all shards failed")) {
thrownExceptions.add(ex);
}
} catch (Throwable t) {
if (!criticalException) {
nonCriticalExceptions.add(t);