You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/06/06 04:56:54 UTC

[05/15] lucene-solr:master: SOLR-9735: Workaround against SOLR-10768

SOLR-9735: Workaround against SOLR-10768


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

Branch: refs/heads/master
Commit: 217a5002e1ec6d285ca290f2005e97e4865e8cfd
Parents: 04dbe59
Author: Shalin Shekhar Mangar <sh...@apache.org>
Authored: Tue May 30 18:33:52 2017 +0530
Committer: Shalin Shekhar Mangar <sh...@apache.org>
Committed: Tue May 30 18:33:59 2017 +0530

----------------------------------------------------------------------
 .../solr/cloud/autoscaling/AutoScalingHandlerTest.java  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/217a5002/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
index 0eaf548..ba60e94 100644
--- a/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
+++ b/solr/core/src/test/org/apache/solr/cloud/autoscaling/AutoScalingHandlerTest.java
@@ -26,6 +26,7 @@ import java.util.Map;
 import org.apache.solr.client.solrj.SolrClient;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrResponse;
+import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.request.CollectionAdminRequest;
@@ -80,7 +81,16 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
     try {
       response = solrClient.request(req);
       fail("Adding a policy with 'cores' attribute should not have succeeded.");
-    } catch (HttpSolrClient.RemoteSolrException e) {
+    } catch (SolrServerException e) {
+      // todo one of these catch blocks should not be needed after SOLR-10768
+      if (e.getRootCause() instanceof HttpSolrClient.RemoteSolrException) {
+        HttpSolrClient.RemoteSolrException rootCause = (HttpSolrClient.RemoteSolrException) e.getRootCause();
+        // expected
+        assertTrue(rootCause.getMessage().contains("cores is only allowed in 'cluster-policy'"));
+      } else  {
+        throw e;
+      }
+    } catch (HttpSolrClient.RemoteSolrException e)  {
       // expected
       assertTrue(e.getMessage().contains("cores is only allowed in 'cluster-policy'"));
     } catch (Exception e) {