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

1996fanrui pushed a commit to branch release-2.3
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-2.3 by this push:
     new 22d775e72bc [FLINK-40088][tests] Tolerate HTTP-level responses in 
RestClientITCase TLS check (#29735)
22d775e72bc is described below

commit 22d775e72bc71e4689f95d50949894fc419d65d8
Author: Rui Fan <[email protected]>
AuthorDate: Wed Nov 4 12:33:10 2026 +0100

    [FLINK-40088][tests] Tolerate HTTP-level responses in RestClientITCase TLS 
check (#29735)
    
    testHttpsConnectionWithDefaultCerts only needs to prove that RestClient
    completes a TLS handshake against a public endpoint using the default JDK
    truststore. It additionally required the response body to be valid JSON, so
    it failed whenever GitHub returned a plain-text 429 Too Many Requests. This
    is structural on GitHub Actions, where runners share egress IPs, and will
    recur more often as CI moves from Azure to GHA.
    
    Any completed HTTP response proves the handshake succeeded, so assert that
    the failure chain contains a RestClientException (which is only produced
    after a full HTTP response is received). A genuine certificate/trust
    regression surfaces as an SSLException instead and still fails the test, as
    do connect-refused, DNS, and connection-reset failures where no handshake
    happened at all.
    
    Generated-by: Claude Fable 5
    (cherry picked from commit 435062c2c83bc264ca1d96b855bf554309fa31f4)
    
    Co-authored-by: Martijn Visser 
<[email protected]>
---
 .../flink/runtime/rest/RestClientITCase.java       | 29 ++++++++++++++++------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff --git 
a/flink-end-to-end-tests/flink-end-to-end-tests-restclient/src/test/java/org/apache/flink/runtime/rest/RestClientITCase.java
 
b/flink-end-to-end-tests/flink-end-to-end-tests-restclient/src/test/java/org/apache/flink/runtime/rest/RestClientITCase.java
index 57cbac116d1..ffc27b03e68 100644
--- 
a/flink-end-to-end-tests/flink-end-to-end-tests-restclient/src/test/java/org/apache/flink/runtime/rest/RestClientITCase.java
+++ 
b/flink-end-to-end-tests/flink-end-to-end-tests-restclient/src/test/java/org/apache/flink/runtime/rest/RestClientITCase.java
@@ -23,7 +23,9 @@ import 
org.apache.flink.runtime.rest.messages.EmptyMessageParameters;
 import org.apache.flink.runtime.rest.messages.EmptyRequestBody;
 import org.apache.flink.runtime.rest.messages.ResponseBody;
 import org.apache.flink.runtime.rest.messages.RuntimeMessageHeaders;
+import org.apache.flink.runtime.rest.util.RestClientException;
 import org.apache.flink.runtime.rest.versioning.RestAPIVersion;
+import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.TestLogger;
 import org.apache.flink.util.concurrent.Executors;
 
@@ -35,8 +37,11 @@ import java.net.URL;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
 /** Tests for {@link RestClient} that rely on external connections. */
 public class RestClientITCase extends TestLogger {
 
@@ -49,14 +54,22 @@ public class RestClientITCase extends TestLogger {
                         
"apache/flink/master/flink-runtime-web/web-dashboard/package.json");
         try (final RestClient restClient =
                 RestClient.forUrl(config, Executors.directExecutor(), 
httpsUrl)) {
-            restClient
-                    .sendRequest(
-                            httpsUrl.getHost(),
-                            443,
-                            testUrlMessageHeaders,
-                            EmptyMessageParameters.getInstance(),
-                            EmptyRequestBody.getInstance())
-                    .get(60, TimeUnit.SECONDS);
+            try {
+                restClient
+                        .sendRequest(
+                                httpsUrl.getHost(),
+                                443,
+                                testUrlMessageHeaders,
+                                EmptyMessageParameters.getInstance(),
+                                EmptyRequestBody.getInstance())
+                        .get(60, TimeUnit.SECONDS);
+            } catch (ExecutionException e) {
+                // A 429/non-JSON body arrives as RestClientException only 
after a successful TLS
+                // handshake; a cert/trust failure surfaces as SSLException 
instead.
+                assertThat(ExceptionUtils.findThrowable(e, 
RestClientException.class))
+                        .as("expected an HTTP response proving the TLS 
handshake succeeded")
+                        .isPresent();
+            }
         }
     }
 

Reply via email to