lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tflo...@apache.org
Subject lucene-solr:branch_7x: SOLR-12222: Improve TestDistributedSearch search
Date Tue, 07 Aug 2018 00:00:59 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_7x d82fc7c3b -> 2fb11404d


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/2fb11404
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2fb11404
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2fb11404

Branch: refs/heads/branch_7x
Commit: 2fb11404d7aecdc6fddbb0763bf14a6958eb6cc3
Parents: d82fc7c
Author: Tomas Fernandez Lobbe <tflobbe@apache.org>
Authored: Mon Aug 6 16:58:08 2018 -0700
Committer: Tomas Fernandez Lobbe <tflobbe@apache.org>
Committed: Mon Aug 6 17:00:50 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/2fb11404/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);
           }


Mime
View raw message