mirror of https://github.com/apache/lucene.git
SOLR-13846: workaround - elliminate use of problematic PreemptiveBasicAuthClientBuilderFactory in tests that don't need it
This commit is contained in:
parent
8dd2ab52b4
commit
939b3364e6
|
@ -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",
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue