>  
> +   @Test
> +   public void testSocketFinderAllowedInterfacesPrivate() throws Exception {
> +      ConcurrentOpenSocketFinder finder = new 
> ConcurrentOpenSocketFinder(socketAlwaysOpen, nodeRunning, userExecutor);
> +      finder.allowedInterfaces = AllowedInterfaces.PRIVATE;
> +      HostAndPort result = finder.findOpenSocketOnNode(node, 22, 2000, 
> MILLISECONDS);
> +      assertEquals(result, HostAndPort.fromParts(PRIVATE_IP, 22));
> +   }
> +   
> +   @Test
> +   public void testSocketFinderAllowedInterfacesPublic() throws Exception {
> +      ConcurrentOpenSocketFinder finder = new 
> ConcurrentOpenSocketFinder(socketAlwaysOpen, nodeRunning, userExecutor);
> +      finder.allowedInterfaces = AllowedInterfaces.PUBLIC;
> +      HostAndPort result = finder.findOpenSocketOnNode(node, 22, 2000, 
> MILLISECONDS);
> +      assertEquals(result, HostAndPort.fromParts(PUBLIC_IP, 22));
> +   }

As your change only modifies the `checkNodeHasIps` method (and not the check 
socket logic), perhaps I'd make that method visible for testing and just test 
that concrete method, with the different inputs, instead of going through the 
entire socket finder path. That would lead to simpler tests and reduce the 
indererminism the timeouts/mock executors may introduce.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/341/files#r11473292

Reply via email to