fix leaked SolrClient in SSLMigrationTest

this doesn't garuntee that this test will pass, but it eliminates the garuntee that it will fail
This commit is contained in:
Chris Hostetter 2018-02-28 15:26:39 -07:00
parent 57cfdb1a48
commit 60984536b0
1 changed files with 5 additions and 1 deletions

View File

@ -16,10 +16,12 @@
*/ */
package org.apache.solr.cloud; package org.apache.solr.cloud;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.lucene.util.LuceneTestCase.BadApple; import org.apache.lucene.util.LuceneTestCase.BadApple;
import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.lucene.util.LuceneTestCase.Slow;
import org.apache.solr.SolrTestCaseJ4.SuppressSSL; import org.apache.solr.SolrTestCaseJ4.SuppressSSL;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrRequest;
import org.apache.solr.client.solrj.embedded.JettyConfig; import org.apache.solr.client.solrj.embedded.JettyConfig;
import org.apache.solr.client.solrj.embedded.JettySolrRunner; import org.apache.solr.client.solrj.embedded.JettySolrRunner;
@ -129,7 +131,9 @@ public class SSLMigrationTest extends AbstractFullDistribZkTestBase {
urls.add(replica.getStr(ZkStateReader.BASE_URL_PROP)); urls.add(replica.getStr(ZkStateReader.BASE_URL_PROP));
} }
//Create new SolrServer to configure new HttpClient w/ SSL config //Create new SolrServer to configure new HttpClient w/ SSL config
getLBHttpSolrClient(urls.toArray(new String[]{})).request(request); try (SolrClient client = getLBHttpSolrClient(urls.toArray(new String[]{}))) {
client.request(request);
}
} }
} }