This is an automated email from the ASF dual-hosted git repository. gerlowskija pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push: new 94e77be2340 SOLR-17043: Fix TestTlogReplica test 94e77be2340 is described below commit 94e77be23408d2cad79e624b8672d2a488394936 Author: Jason Gerlowski <gerlowsk...@apache.org> AuthorDate: Thu Apr 24 07:22:59 2025 -0400 SOLR-17043: Fix TestTlogReplica test Test was using 'QueryRequest' (of type 'QUERY') to send a rebalance-leaders API call (which needs a request of type 'ADMIN'). This was causing SolrJ to build the path incorrectly and fail. This commit changes the test to use GenericSolrRequest, until we have a more functional RebalanceLeadersSolrRequest --- .../test/org/apache/solr/cloud/TestTlogReplica.java | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java index 0c7b5a912bd..a7a0306b04c 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java @@ -46,12 +46,13 @@ import org.apache.http.util.EntityUtils; import org.apache.lucene.index.IndexWriter; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrQuery; +import org.apache.solr.client.solrj.SolrRequest; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.impl.CloudLegacySolrClient; import org.apache.solr.client.solrj.impl.CloudSolrClient; import org.apache.solr.client.solrj.impl.HttpSolrClient; import org.apache.solr.client.solrj.request.CollectionAdminRequest; -import org.apache.solr.client.solrj.request.QueryRequest; +import org.apache.solr.client.solrj.request.GenericSolrRequest; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.response.CollectionAdminResponse; import org.apache.solr.client.solrj.response.QueryResponse; @@ -811,8 +812,12 @@ public class TestTlogReplica extends SolrCloudTestCase { params.set("replica", newLeader.getName()); params.set("property", "preferredLeader"); params.set("property.value", "true"); - QueryRequest request = new QueryRequest(params); - request.setPath("/admin/collections"); + var request = + new GenericSolrRequest( + SolrRequest.METHOD.POST, + "/admin/collections", + SolrRequest.SolrRequestType.ADMIN, + params); cloudClient.request(request); // Wait until a preferredleader flag is set to the new leader candidate @@ -833,8 +838,12 @@ public class TestTlogReplica extends SolrCloudTestCase { params.set("action", CollectionParams.CollectionAction.REBALANCELEADERS.toString()); params.set("collection", collectionName); params.set("maxAtOnce", "10"); - request = new QueryRequest(params); - request.setPath("/admin/collections"); + request = + new GenericSolrRequest( + SolrRequest.METHOD.POST, + "/admin/collections", + SolrRequest.SolrRequestType.ADMIN, + params); cloudClient.request(request); // Wait until a new leader is elected