You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/08/10 09:13:45 UTC

[05/31] lucene-solr:jira/http2: SOLR-12222: Improve TestDistributedSearch search

SOLR-12222: Improve TestDistributedSearch search

Consider the case when the distributed requests fails with timeAllowed before it reaches the shards


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/896fd0eb
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/896fd0eb
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/896fd0eb

Branch: refs/heads/jira/http2
Commit: 896fd0ebd55aaafa51222aa9200e16f2dbb093e4
Parents: db1e064
Author: Tomas Fernandez Lobbe <tf...@apache.org>
Authored: Mon Aug 6 16:58:08 2018 -0700
Committer: Tomas Fernandez Lobbe <tf...@apache.org>
Committed: Mon Aug 6 16:58:08 2018 -0700

----------------------------------------------------------------------
 .../test/org/apache/solr/TestDistributedSearch.java | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/896fd0eb/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
index c9be70f..3ec1c6d 100644
--- a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
+++ b/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
@@ -1186,14 +1186,20 @@ public class TestDistributedSearch extends BaseDistributedSearchTestCase {
         String s = shardsArr[i];
         if (shard.contains(s)) {
           found = true;
-          // make sure that it responded if it's up
+          // make sure that it responded if it's up and the landing node didn't error before sending the request to the shard
           if (upShards.contains(s)) {
             // this is no longer true if there was a query timeout on an up shard
             // assertTrue("Expected to find numFound in the up shard info",info.get("numFound") != null);
-            assertTrue("Expected to find shardAddress in the up shard info: " + info.toString(), info.get("shardAddress") != null);
-          }
-          else {
-            assertEquals("Expected to find the "+SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY+" header set if a shard is down",
+            boolean timeAllowedError = info.get("error") != null && info.get("error").toString().contains("Time allowed to handle this request");
+            if (timeAllowedError) {
+              assertEquals("Expected to find the " + SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY + " header set if a shard is down",
+                  Boolean.TRUE, rsp.getHeader().get(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY));
+              assertTrue("Expected to find error in the down shard info: " + info.toString(), info.get("error") != null);
+            } else {
+              assertTrue("Expected timeAllowedError or to find shardAddress in the up shard info: " + info.toString(), info.get("shardAddress") != null);
+            }
+          } else {
+            assertEquals("Expected to find the " + SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY + " header set if a shard is down",
                 Boolean.TRUE, rsp.getHeader().get(SolrQueryResponse.RESPONSE_HEADER_PARTIAL_RESULTS_KEY));
             assertTrue("Expected to find error in the down shard info: " + info.toString(), info.get("error") != null);
           }