dsmiley commented on code in PR #1158:
URL: https://github.com/apache/solr/pull/1158#discussion_r1013976253


##########
solr/core/src/test/org/apache/solr/schema/TestCloudManagedSchema.java:
##########
@@ -53,12 +54,11 @@ public void test() throws Exception {
     QueryRequest request = new QueryRequest(params);
     request.setPath("/admin/cores");
     int which = r.nextInt(clients.size());
-    HttpSolrClient client = (HttpSolrClient) clients.get(which);
-    String previousBaseURL = client.getBaseURL();
-    // Strip /collection1 step from baseURL - requests fail otherwise
-    client.setBaseURL(previousBaseURL.substring(0, 
previousBaseURL.lastIndexOf("/")));
-    NamedList<?> namedListResponse = client.request(request);
-    client.setBaseURL(previousBaseURL); // Restore baseURL
+
+    // create a client that does not have the /collection1 as part of the URL.
+    SolrClient rootClient =
+        new 
HttpSolrClient.Builder(buildUrl(jettys.get(which).getLocalPort())).build();
+    NamedList<?> namedListResponse = rootClient.request(request);

Review Comment:
   Your change will probably leave an un-closed SolrClient hanging around, 
which will fail.



##########
solr/core/src/test/org/apache/solr/search/TestSmileRequest.java:
##########
@@ -71,7 +71,7 @@ public void testDistribJsonRequest() throws Exception {
           @Override
           public void assertJQ(SolrClient client, SolrParams args, String... 
tests)
               throws Exception {
-            ((HttpSolrClient) client).setParser(SmileResponseParser.inst);
+            ((HttpSolrClient) client).setParser(new SmileResponseParser());

Review Comment:
   Okay but surely moving away from a global instance to creating a new 
instance (of this parser thing) will have zero effect on solving these 
complications around SolrClient lifecycle/mutability.
   
   Looking at this specific scenario, it seems to me we need/want to be able to 
set the parser for a specific request, which will not run afoul of our 
immutability plans for SolrClient.  At the SolrClient level, setting this 
parser is more global (across requests).  SolrQueryRequest has a 
setResponseParser; try that.



-- 
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

Reply via email to