瀏覽代碼

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

Simon Willnauer 11 年之前
父節點
當前提交
034ce75250
共有 1 個文件被更改,包括 7 次插入0 次删除
  1. 7 0
      src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java

+ 7 - 0
src/test/java/org/elasticsearch/search/basic/SearchWhileRelocatingTests.java

@@ -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);