You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "dsmiley (via GitHub)" <gi...@apache.org> on 2023/03/30 14:35:59 UTC

[GitHub] [solr] dsmiley commented on a diff in pull request #1499: SOLR-16604: Use the Builders directly in unit tests

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


##########
solr/test-framework/src/java/org/apache/solr/cloud/AbstractUnloadDistributedZkTestBase.java:
##########
@@ -285,7 +287,11 @@ private void testCoreUnloadAndLeaders() throws Exception {
     // collectionClient.commit();
 
     // unload the leader
-    try (SolrClient collectionClient = getHttpSolrClient(leaderProps.getBaseUrl(), 15000, 30000)) {
+    try (SolrClient collectionClient =
+        new HttpSolrClient.Builder(leaderProps.getBaseUrl())
+            .withConnectionTimeout(15000, TimeUnit.MILLISECONDS)
+            .withSocketTimeout(30000, TimeUnit.MILLISECONDS)
+            .build()) {

Review Comment:
   This test class seems to always want a client with specific timeouts.  Then create a utility method _in this test_ for it.



##########
solr/core/src/test/org/apache/solr/cloud/LeaderVoteWaitTimeoutTest.java:
##########
@@ -343,6 +344,6 @@ private NamedList<Object> realTimeGetDocId(SolrClient solr, String docId)
   protected SolrClient getSolrClient(Replica replica, String coll) {
     ZkCoreNodeProps zkProps = new ZkCoreNodeProps(replica);
     String url = zkProps.getBaseUrl() + "/" + coll;
-    return getHttpSolrClient(url);
+    return new Http2SolrClient.Builder(url).build();

Review Comment:
   just a url; can use the STCJ4 method



##########
solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java:
##########
@@ -543,7 +544,7 @@ protected void assertDocsExistInAllReplicas(
   protected SolrClient getHttpSolrClient(Replica replica, String collection) {
     ZkCoreNodeProps zkProps = new ZkCoreNodeProps(replica);
     String url = zkProps.getBaseUrl() + "/" + collection;
-    return getHttpSolrClient(url);
+    return new Http2SolrClient.Builder(url).build();

Review Comment:
   just a url; can use the STCJ4 method



##########
solr/core/src/test/org/apache/solr/cloud/api/collections/ShardSplitTest.java:
##########
@@ -1268,7 +1268,11 @@ protected void splitShard(
         ((HttpSolrClient) shardToJetty.get(SHARD1).get(0).client.getSolrClient()).getBaseURL();
     baseUrl = baseUrl.substring(0, baseUrl.length() - "collection1".length());
 
-    try (SolrClient baseServer = getHttpSolrClient(baseUrl, 30000, 60000 * 5)) {
+    try (SolrClient baseServer =
+        new HttpSolrClient.Builder(baseUrl)
+            .withConnectionTimeout(30000, TimeUnit.MILLISECONDS)
+            .withSocketTimeout(60000 * 5, TimeUnit.MILLISECONDS)

Review Comment:
   It's sad to see this... can we just say 5 minutes?



##########
solr/core/src/test/org/apache/solr/cloud/TestCloudConsistency.java:
##########
@@ -351,6 +352,6 @@ private NamedList<Object> realTimeGetDocId(SolrClient solr, String docId)
   protected SolrClient getHttpSolrClient(Replica replica, String coll) {
     ZkCoreNodeProps zkProps = new ZkCoreNodeProps(replica);
     String url = zkProps.getBaseUrl() + "/" + coll;
-    return getHttpSolrClient(url);
+    return new Http2SolrClient.Builder(url).build();

Review Comment:
   just a url; can use the STCJ4 method



##########
solr/test-framework/src/test/org/apache/solr/embedded/TestJettySolrRunner.java:
##########
@@ -55,7 +56,8 @@ public void testPassSolrHomeToRunner() throws Exception {
     try {
       runner.start();
 
-      try (SolrClient client = getHttpSolrClient(runner.getBaseUrl().toString())) {
+      try (SolrClient client =
+          new Http2SolrClient.Builder(runner.getBaseUrl().toString()).build()) {

Review Comment:
   you were going to keep these as they were; no?  (only URL arg)



-- 
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-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org