XComp commented on code in PR #28676:
URL: https://github.com/apache/flink/pull/28676#discussion_r3538931106


##########
flink-end-to-end-tests/flink-end-to-end-tests-restclient/src/test/java/org/apache/flink/runtime/rest/RestClientITCase.java:
##########
@@ -51,14 +56,22 @@ void testHttpsConnectionWithDefaultCerts() throws Exception 
{
                         
"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();

Review Comment:
   ```suggestion
                           
.map(RestClientException::getHttpResponseStatus).hasValue(HttpResponseStatus.TOO_MANY_REQUESTS);
   ```
   Should we make it more specific? Otherwise, the test might also succeed if 
another unexpected failure appears. The downside is that the test might be 
flaky still if the GHA behavior changes. But in that case, extending the test 
would be probably the right approach.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to