This is an automated email from the ASF dual-hosted git repository.
dsmiley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 2dcc1320504 SOLR-16458: Fix flaky test HealthCheckHandlerTest due to
SSL (#4247)
2dcc1320504 is described below
commit 2dcc1320504e7ae597c78c529e0af7a291c0f8dd
Author: David Smiley <[email protected]>
AuthorDate: Wed Apr 1 09:14:06 2026 -0400
SOLR-16458: Fix flaky test HealthCheckHandlerTest due to SSL (#4247)
Switching from Apache HttpClient to Jetty HttpClient -- the latter is
already configured in our test infra for SSL.
---
.../solr/handler/admin/HealthCheckHandlerTest.java | 30 +++++++++-------------
1 file changed, 12 insertions(+), 18 deletions(-)
diff --git
a/solr/core/src/test/org/apache/solr/handler/admin/HealthCheckHandlerTest.java
b/solr/core/src/test/org/apache/solr/handler/admin/HealthCheckHandlerTest.java
index 79036e5c16e..96cb2f4c425 100644
---
a/solr/core/src/test/org/apache/solr/handler/admin/HealthCheckHandlerTest.java
+++
b/solr/core/src/test/org/apache/solr/handler/admin/HealthCheckHandlerTest.java
@@ -21,10 +21,6 @@ import static
org.apache.solr.common.params.CommonParams.HEALTH_CHECK_HANDLER_PA
import static org.hamcrest.Matchers.containsString;
import java.io.IOException;
-import java.net.URI;
-import java.net.http.HttpClient;
-import java.net.http.HttpRequest;
-import java.net.http.HttpResponse;
import java.util.Arrays;
import java.util.Collection;
import java.util.Properties;
@@ -49,6 +45,7 @@ import org.apache.solr.common.params.CommonParams;
import org.apache.solr.core.CoreDescriptor;
import org.apache.solr.embedded.JettySolrRunner;
import org.apache.solr.handler.admin.api.NodeHealth;
+import org.eclipse.jetty.client.ContentResponse;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -172,20 +169,17 @@ public class HealthCheckHandlerTest extends
SolrCloudTestCase {
// Use a raw HTTP request so we can inspect the full response body.
// SolrJ's HealthCheckRequest throws RemoteSolrException on non-200
responses and does
// not expose the response body, so we go below SolrJ here.
- try (HttpClient httpClient = HttpClient.newHttpClient()) {
- HttpResponse<String> response =
- httpClient.send(
- HttpRequest.newBuilder()
- .uri(URI.create(newJetty.getBaseUrl() +
HEALTH_CHECK_HANDLER_PATH))
- .build(),
- HttpResponse.BodyHandlers.ofString());
-
- assertEquals("Expected 503 SERVICE_UNAVAILABLE", 503,
response.statusCode());
- assertThat(
- "v1 error response body must contain status=FAILURE so
body-inspecting clients get a clear signal",
- response.body(),
- containsString("FAILURE"));
- }
+ ContentResponse response =
+ newJetty
+ .getSolrClient()
+ .getHttpClient()
+ .GET(newJetty.getBaseUrl() + HEALTH_CHECK_HANDLER_PATH);
+
+ assertEquals("Expected 503 SERVICE_UNAVAILABLE", 503,
response.getStatus());
+ assertThat(
+ "v1 error response body must contain status=FAILURE so
body-inspecting clients get a clear signal",
+ response.getContentAsString(),
+ containsString("FAILURE"));
} finally {
newJetty.stop();
}