This is an automated email from the ASF dual-hosted git repository. mapohl pushed a commit to branch release-1.17 in repository https://gitbox.apache.org/repos/asf/flink.git
commit 805ec75c715a56e1d1616189b0d4b7d22361ece3 Author: Patrick Lucas <[email protected]> AuthorDate: Thu Jul 20 17:19:11 2023 +0200 [hotfix][rest] Improve RestClientTest test case - Ensure expected exception is actually thrown by not asserting in `catch` block - Remove timeout from future `get` per Flink coding convention --- .../org/apache/flink/runtime/rest/RestClientTest.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestClientTest.java b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestClientTest.java index 370dbacd2cfd..e33a0d0ee5e6 100644 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestClientTest.java +++ b/flink-runtime/src/test/java/org/apache/flink/runtime/rest/RestClientTest.java @@ -79,18 +79,17 @@ public class RestClientTest extends TestLogger { final Configuration config = new Configuration(); config.setLong(RestOptions.CONNECTION_TIMEOUT, 1); try (final RestClient restClient = new RestClient(config, Executors.directExecutor())) { - restClient - .sendRequest( + CompletableFuture<?> future = + restClient.sendRequest( unroutableIp, 80, new TestMessageHeaders(), EmptyMessageParameters.getInstance(), - EmptyRequestBody.getInstance()) - .get(60, TimeUnit.SECONDS); - } catch (final ExecutionException e) { - final Throwable throwable = ExceptionUtils.stripExecutionException(e); - assertThat(throwable, instanceOf(ConnectTimeoutException.class)); - assertThat(throwable.getMessage(), containsString(unroutableIp)); + EmptyRequestBody.getInstance()); + + final Throwable cause = assertThrows(ExecutionException.class, future::get).getCause(); + assertThat(cause, instanceOf(ConnectTimeoutException.class)); + assertThat(cause.getMessage(), containsString(unroutableIp)); } }
