SOLR-9735: Workaround against SOLR-10768

This commit is contained in:
Shalin Shekhar Mangar 2017-05-30 18:33:52 +05:30
parent 04dbe59071
commit 217a5002e1
1 changed files with 11 additions and 1 deletions

View File

@ -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,6 +81,15 @@ public class AutoScalingHandlerTest extends SolrCloudTestCase {
try {
response = solrClient.request(req);
fail("Adding a policy with 'cores' attribute should not have succeeded.");
} 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'"));