Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2455#discussion_r77326942
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/rpc/akka/AkkaRpcServiceTest.java
 ---
    @@ -84,4 +89,35 @@ public void run() {
     
                assertTrue("call was not properly delayed", ((stop - start) / 
1000000) >= delay);
        }
    +
    +   /**
    +    * Test connect method
    +    * 1. Get the same result when connect the same address and same 
gateway class
    +    * 2. Failed when connect to invalid address
    +    * @throws Exception
    +    */
    +   @Test
    +   public void testConnect() throws Exception {
    +           TestingLeaderElectionService leaderElectionService = new 
TestingLeaderElectionService();
    +           TestingHighAvailabilityServices highAvailabilityServices = new 
TestingHighAvailabilityServices();
    +           
highAvailabilityServices.setResourceManagerLeaderElectionService(leaderElectionService);
    +
    +           ResourceManager rm = new ResourceManager(akkaRpcService, 
highAvailabilityServices);
    +           rm.start();
    +           String address = rm.getAddress();
    +           // verify get the same result when connect the same address and 
same gateway class
    +           Future<ResourceManagerGateway> rmGatewayFuture1 = 
akkaRpcService.connect(address, ResourceManagerGateway.class);
    +           ResourceManagerGateway rmGateway1 = 
Await.result(rmGatewayFuture1, new FiniteDuration(200, TimeUnit.MILLISECONDS));
    +
    +           Future<ResourceManagerGateway> rmGatewayFuture2 = 
akkaRpcService.connect(address, ResourceManagerGateway.class);
    +           ResourceManagerGateway rmGateway2 = 
Await.result(rmGatewayFuture2, new FiniteDuration(200, TimeUnit.MILLISECONDS));
    +
    +           Assert.assertEquals(rmGateway1, rmGateway2);
    +           Assert.assertEquals(rmGateway1.hashCode(), 
rmGateway2.hashCode());
    +
    +           // verify failed when connect to invalid address
    +           String invalidString = "abc";
    +           Future<ResourceManagerGateway> invalidRmGatewayFuture = 
akkaRpcService.connect(invalidString, ResourceManagerGateway.class);
    +           assertTrue(invalidRmGatewayFuture.failed().value().get().get() 
instanceof RuntimeException);
    --- End diff --
    
    Maybe you should check whether the future is completed. You could obtain 
the result via `Await.result(future, timeout)`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to