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

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

commit 5a0609aa55c3ea69746a27a19622d8c97da772f9
Author: Roman Khachatryan <[email protected]>
AuthorDate: Fri Nov 12 12:53:46 2021 +0100

    [FLINK-22419] Wait unlimited in RpcEndpointTest.testCallAsyncTimeout
---
 .../src/test/java/org/apache/flink/runtime/rpc/RpcEndpointTest.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git 
a/flink-runtime/src/test/java/org/apache/flink/runtime/rpc/RpcEndpointTest.java 
b/flink-runtime/src/test/java/org/apache/flink/runtime/rpc/RpcEndpointTest.java
index abd020f..eaf573d 100644
--- 
a/flink-runtime/src/test/java/org/apache/flink/runtime/rpc/RpcEndpointTest.java
+++ 
b/flink-runtime/src/test/java/org/apache/flink/runtime/rpc/RpcEndpointTest.java
@@ -361,13 +361,14 @@ public class RpcEndpointTest extends TestLogger {
             throws InterruptedException, ExecutionException, TimeoutException {
         final RpcEndpoint endpoint = new BaseEndpoint(rpcService);
         final Time timeout = Time.milliseconds(100);
+        CountDownLatch latch = new CountDownLatch(1);
         try {
             endpoint.start();
             final CompletableFuture<Throwable> throwableFuture =
                     endpoint.callAsync(
                                     () -> {
                                         endpoint.validateRunsInMainThread();
-                                        
TimeUnit.MILLISECONDS.sleep(timeout.toMilliseconds() * 2);
+                                        latch.await();
                                         return 12345;
                                     },
                                     timeout)
@@ -377,6 +378,7 @@ public class RpcEndpointTest extends TestLogger {
             assertNotNull(throwable);
             assertThat(throwable, instanceOf(TimeoutException.class));
         } finally {
+            latch.countDown();
             RpcUtils.terminateRpcEndpoint(endpoint, TIMEOUT);
         }
     }

Reply via email to