Apache Solr open-source search software
build/tests: tests.ssl=false now works (#4500)
David Smiley454ef4b24fd6
diff --git a/gradle/testing/randomization.gradle b/gradle/testing/randomization.gradleindex 2bf7d2ae965..98787442cc2 100644--- a/gradle/testing/randomization.gradle+++ b/gradle/testing/randomization.gradle@@ -133,7 +133,7 @@ configure(allprojects.findAll {project -> project.path.startsWith(":solr")}) {testOptions += [[propName: 'tests.src.home', value: null, description: "See SOLR-14023."],[propName: 'solr.tests.use.numeric.points', value: null, description: "Point implementation to use (true=numerics, false=trie)."],- [propName: 'tests.ssl', value: false, description: "Force SSL on for all tests that support it (respects @SuppressSSL)."],+ [propName: 'tests.ssl', value: null, description: "Control SSL: true=force on, false=force off, unset=randomize (all respect @SuppressSSL)."],]}}diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.javaindex 34e9551c919..fc054b5da09 100644--- a/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java+++ b/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java@@ -87,8 +87,14 @@ public class GetMetricsTest extends SolrTestCaseJ4 {@AfterClasspublic static void afterClass() throws Exception {- jettyHttpClient.destroy();- cluster.shutdown();+ if (jettyHttpClient != null) {+ jettyHttpClient.destroy();+ jettyHttpClient = null;+ }+ if (cluster != null) {+ cluster.shutdown();+ cluster = null;+ }}@Beforediff --git a/solr/test-framework/src/java/org/apache/solr/util/RandomizeSSL.java b/solr/test-framework/src/java/org/apache/solr/util/RandomizeSSL.javaindex 1e8afd0a506..f94fd68846a 100644--- a/solr/test-framework/src/java/org/apache/solr/util/RandomizeSSL.java+++ b/solr/test-framework/src/java/org/apache/solr/util/RandomizeSSL.java@@ -16,6 +16,8 @@*/package org.apache.solr.util;+import static org.junit.Assume.assumeFalse;+import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.annotation.Inherited;@@ -126,8 +128,14 @@ public @interface RandomizeSSL {LuceneTestCase.TEST_NIGHTLY,LuceneTestCase.RANDOM_MULTIPLIER));- if (Boolean.getBoolean("tests.ssl") && ssl > 0.0D) {+ // a test can configure @RandomizeSSL(0.0) or with 1.0, and we must honor that.+ final String sslProp = System.getProperty("tests.ssl");+ if ("true".equals(sslProp)) {+ assumeFalse("tests.ssl=true but test does not support SSL", ssl == 0.0);return new SSLTestConfig(true, useClientAuth);+ } else if ("false".equals(sslProp)) {+ assumeFalse("tests.ssl=false but test requires SSL", ssl == 1.0);+ return new SSLTestConfig(false, false);}return new SSLTestConfig(useSSL, useClientAuth);