This is an automated email from the ASF dual-hosted git repository.

dsmiley pushed a commit to branch branch_10x
in repository https://gitbox.apache.org/repos/asf/solr.git

commit 4f9a39ccfecd154bb61760137b649af78dbb33ea
Author: David Smiley <[email protected]>
AuthorDate: Mon Jun 8 23:19:42 2026 -0400

    build/tests: tests.ssl=false now works (#4500)
---
 gradle/testing/randomization.gradle                            |  2 +-
 .../test/org/apache/solr/handler/admin/api/GetMetricsTest.java | 10 ++++++++--
 .../src/java/org/apache/solr/util/RandomizeSSL.java            | 10 +++++++++-
 3 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/gradle/testing/randomization.gradle 
b/gradle/testing/randomization.gradle
index 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.java
index 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 {
 
   @AfterClass
   public static void afterClass() throws Exception {
-    jettyHttpClient.destroy();
-    cluster.shutdown();
+    if (jettyHttpClient != null) {
+      jettyHttpClient.destroy();
+      jettyHttpClient = null;
+    }
+    if (cluster != null) {
+      cluster.shutdown();
+      cluster = null;
+    }
   }
 
   @Before
diff --git 
a/solr/test-framework/src/java/org/apache/solr/util/RandomizeSSL.java 
b/solr/test-framework/src/java/org/apache/solr/util/RandomizeSSL.java
index 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);

Reply via email to