Apache Lucene open-source search software
SOLR-12222: Improve TestDistributedSearch search
Tomas Fernandez Lobbe896fd0ebd55a
diff --git a/solr/core/src/test/org/apache/solr/TestDistributedSearch.java b/solr/core/src/test/org/apache/solr/TestDistributedSearch.javaindex c9be70f4bf0..3ec1c6d7cb7 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 shardif (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);}