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

MartijnVisser pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/master by this push:
     new 435062c2c83 [FLINK-40088][tests] Tolerate HTTP-level responses in 
RestClientITCase TLS check
435062c2c83 is described below

commit 435062c2c83bc264ca1d96b855bf554309fa31f4
Author: Martijn Visser <[email protected]>
AuthorDate: Tue Jul 7 14:45:50 2026 +0200

    [FLINK-40088][tests] Tolerate HTTP-level responses in RestClientITCase TLS 
check
    
    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
---
 .../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 fb3c77339e9..8ed2936b47d 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.TestLoggerExtension;
 import org.apache.flink.util.concurrent.Executors;
 
@@ -36,8 +38,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. */
 @ExtendWith(TestLoggerExtension.class)
 class RestClientITCase {
@@ -51,14 +56,22 @@ class RestClientITCase {
                         
"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