dsmiley commented on code in PR #1632: URL: https://github.com/apache/solr/pull/1632#discussion_r1306186982
########## solr/core/src/test/org/apache/solr/servlet/HideStackTraceTest.java: ########## @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.servlet; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.invoke.MethodHandles; +import java.nio.file.Path; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathFactory; +import org.apache.http.client.config.CookieSpecs; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.config.RequestConfig.Builder; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.solr.SolrJettyTestBase; +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.SolrTestCaseJ4.SuppressSSL; +import org.apache.solr.handler.component.ResponseBuilder; +import org.apache.solr.handler.component.SearchComponent; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; + +/** SOLR-14886 : Suppress stack trace in Query response */ +@SuppressSSL +public class HideStackTraceTest extends SolrJettyTestBase { + private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + private static Path solrHome; + + @BeforeClass + public static void before() throws Exception { + initCore("solrconfig-errorComponent.xml", "schema.xml"); + createAndStartJetty(SolrTestCaseJ4.TEST_PATH().toAbsolutePath().toString()); + } + + @AfterClass + public static void after() throws Exception { + afterSolrJettyTestBase(); + if (solrHome != null) { + cleanUpJettyHome(solrHome.toFile()); + } + } + + @Test + public void testHideStackTrace() throws Exception { + final String url = jetty.getBaseUrl().toString() + "/collection1/withError?q=*:*&wt=xml"; + final HttpGet get = new HttpGet(url); Review Comment: Does this test need to work with HTTP at all? I believe not; the stack trace should be in the response structure. See EmbeddedSolrServerTestRule -- a new test mechanism for a new breed of tests that can work with a SolrClient. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org