Skip to content

Commit 520e649

Browse files
authored
SolrTestCaseJ4: don't reset HttpClient SSL stuff (#3037)
Only a test or two need to actually clear this. AfterClass no longer calls: * HttpClientUtil.resetHttpClientBuilder(); * Http2SolrClient.resetSslContextFactory();
1 parent 861a776 commit 520e649

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

solr/core/src/test/org/apache/solr/cloud/SSLMigrationTest.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import org.apache.solr.embedded.JettyConfig;
3838
import org.apache.solr.embedded.JettySolrRunner;
3939
import org.apache.solr.util.SSLTestConfig;
40+
import org.junit.After;
4041
import org.junit.Test;
4142

4243
/**
@@ -47,6 +48,11 @@
4748
@AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-12028") // 17-Mar-2018
4849
public class SSLMigrationTest extends AbstractFullDistribZkTestBase {
4950

51+
@After
52+
public void afterTest() {
53+
HttpClientUtil.resetHttpClientBuilder(); // also resets SocketFactoryRegistryProvider
54+
}
55+
5056
@Test
5157
public void test() throws Exception {
5258
// Migrate from HTTP -> HTTPS -> HTTP
@@ -64,7 +70,7 @@ public void testMigrateSSL(SSLTestConfig sslConfig) throws Exception {
6470
}
6571

6672
HttpClientUtil.setSocketFactoryRegistryProvider(
67-
sslConfig.buildClientSocketFactoryRegistryProvider());
73+
sslConfig.buildClientSocketFactoryRegistryProvider()); // we reset in After
6874
for (int i = 0; i < this.jettys.size(); i++) {
6975
JettySolrRunner runner = jettys.get(i);
7076
JettyConfig config =

solr/core/src/test/org/apache/solr/cloud/TestMiniSolrCloudClusterSSL.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ public void after() {
104104
public void testNoSsl() throws Exception {
105105
final SSLTestConfig sslConfig = new SSLTestConfig(false, false);
106106
HttpClientUtil.setSocketFactoryRegistryProvider(
107-
sslConfig.buildClientSocketFactoryRegistryProvider());
108-
Http2SolrClient.setDefaultSSLConfig(sslConfig.buildClientSSLConfig());
107+
sslConfig.buildClientSocketFactoryRegistryProvider()); // must be reset
108+
Http2SolrClient.setDefaultSSLConfig(sslConfig.buildClientSSLConfig()); // must be reset
109109
System.setProperty(ZkStateReader.URL_SCHEME, "http");
110110
checkClusterWithNodeReplacement(sslConfig);
111111
}

solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,6 @@ public static void teardownTestCases() throws Exception {
327327
System.clearProperty(URL_SCHEME);
328328
System.clearProperty("solr.cloud.wait-for-updates-with-stale-state-pause");
329329
System.clearProperty("solr.zkclienttmeout");
330-
HttpClientUtil.resetHttpClientBuilder();
331-
Http2SolrClient.resetSslContextFactory();
332330

333331
clearNumericTypesProperties();
334332

0 commit comments

Comments
 (0)