You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2019/10/15 22:55:34 UTC
[lucene-solr] branch branch_8x updated: SOLR-13846: workaround -
elliminate use of problematic PreemptiveBasicAuthClientBuilderFactory in
tests that don't need it
This is an automated email from the ASF dual-hosted git repository.
hossman pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 59548c1 SOLR-13846: workaround - elliminate use of problematic PreemptiveBasicAuthClientBuilderFactory in tests that don't need it
59548c1 is described below
commit 59548c16d36523de61c75881fa5981a629c046cd
Author: Chris Hostetter <ho...@apache.org>
AuthorDate: Tue Oct 15 15:37:33 2019 -0700
SOLR-13846: workaround - elliminate use of problematic PreemptiveBasicAuthClientBuilderFactory in tests that don't need it
(cherry picked from commit 939b3364e604a4a16b3c4c5f278c4d7f30f1354b)
---
.../org/apache/solr/cloud/TestQueryingOnDownCollection.java | 8 --------
.../org/apache/solr/security/BasicAuthOnSingleNodeTest.java | 12 +++---------
2 files changed, 3 insertions(+), 17 deletions(-)
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java b/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java
index 763cdd4..1cd70f4 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestQueryingOnDownCollection.java
@@ -18,14 +18,12 @@ package org.apache.solr.cloud;
import java.lang.invoke.MethodHandles;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
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.impl.Http2SolrClient;
-import org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.client.solrj.request.UpdateRequest;
@@ -45,10 +43,6 @@ public class TestQueryingOnDownCollection extends SolrCloudTestCase {
private static final String USERNAME = "solr";
private static final String PASSWORD = "solr";
- static {
- System.setProperty("basicauth", String.format(Locale.ROOT,"{}:{}", USERNAME, PASSWORD));
- }
-
@BeforeClass
public static void setupCluster() throws Exception {
configureCluster(3)
@@ -107,8 +101,6 @@ public class TestQueryingOnDownCollection extends SolrCloudTestCase {
// run same set of tests on v2 client which uses V2HttpCall
Http2SolrClient v2Client = new Http2SolrClient.Builder(cluster.getJettySolrRunner(0).getBaseUrl().toString())
.build();
- PreemptiveBasicAuthClientBuilderFactory factory = new PreemptiveBasicAuthClientBuilderFactory();
- factory.setup(v2Client);
error = expectThrows(SolrException.class,
"Request should fail after trying all replica nodes once",
diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
index 974e940..bcfe608 100644
--- a/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
+++ b/solr/core/src/test/org/apache/solr/security/BasicAuthOnSingleNodeTest.java
@@ -19,11 +19,10 @@ package org.apache.solr.security;
import java.lang.invoke.MethodHandles;
-import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
-import org.apache.solr.client.solrj.impl.PreemptiveBasicAuthClientBuilderFactory;
import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
import org.apache.solr.cloud.SolrCloudAuthTestCase;
import org.junit.Before;
import org.junit.Test;
@@ -35,10 +34,6 @@ public class BasicAuthOnSingleNodeTest extends SolrCloudAuthTestCase {
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
private static final String COLLECTION = "authCollection";
- static {
- System.setProperty("basicauth", "solr:solr");
- }
-
@Before
public void setupCluster() throws Exception {
configureCluster(1)
@@ -63,13 +58,12 @@ public class BasicAuthOnSingleNodeTest extends SolrCloudAuthTestCase {
public void basicTest() throws Exception {
try (Http2SolrClient client = new Http2SolrClient.Builder(cluster.getJettySolrRunner(0).getBaseUrl().toString())
.build()){
- PreemptiveBasicAuthClientBuilderFactory factory = new PreemptiveBasicAuthClientBuilderFactory();
- factory.setup(client);
// SOLR-13510, this will be failed if the listener (handling inject credential in header) is called in another
// thread since SolrRequestInfo will return null in that case.
for (int i = 0; i < 30; i++) {
- client.query(COLLECTION, new SolrQuery("*:*"));
+ assertNotNull(new QueryRequest(params("q", "*:*"))
+ .setBasicAuthCredentials("solr", "solr").process(client, COLLECTION));
}
}
}