@Test public void testReturnsSameNodeWhenNotFoundInCache() throws Exception { RegionAndName key = new RegionAndName("us-east-1", node.getProviderId()); String val = null; LoadingCache<RegionAndName, String> cache = cacheOf(key, val); AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache); assertEquals(fn.apply(node).getPublicAddresses(), ImmutableSet.of("174.129.173.155")); }
@Test public void testReturnsNodeWithElasticIpWhenFoundInCacheAndNodeHadAPublicIp() throws Exception { RegionAndName key = new RegionAndName("us-east-1", node.getProviderId()); String val = "1.1.1.1"; LoadingCache<RegionAndName, String> cache = cacheOf(key, val); AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache); assertEquals(fn.apply(node).getPublicAddresses(), ImmutableSet.of("1.1.1.1")); }
@Test public void testReturnsSameNodeWhenNotFoundInCache() throws Exception { RegionAndName key = new RegionAndName("us-east-1", node.getProviderId()); String val = null; LoadingCache<RegionAndName, String> cache = cacheOf(key, val); AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache); assertEquals(fn.apply(node).getPublicAddresses(), ImmutableSet.of("174.129.173.155")); }
@Test public void testReturnsNodeWithElasticIpWhenFoundInCacheAndNodeHadAPublicIp() throws Exception { RegionAndName key = new RegionAndName("us-east-1", node.getProviderId()); String val = "1.1.1.1"; LoadingCache<RegionAndName, String> cache = cacheOf(key, val); AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache); assertEquals(fn.apply(node).getPublicAddresses(), ImmutableSet.of("1.1.1.1")); }
@Test public void testReturnsNodeWithIpWhenFoundInCacheAndNodeHadNoPublicIp() throws Exception { RegionAndName key = new RegionAndName("us-east-1", node.getProviderId()); String val = "1.1.1.1"; LoadingCache<RegionAndName, String> cache = cacheOf(key, val); AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache); assertEquals(fn.apply( NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.<String> of()).build()) .getPublicAddresses(), ImmutableSet.of("1.1.1.1")); }
@Test public void testReturnsNodeWithIpWhenFoundInCacheAndNodeHadNoPublicIp() throws Exception { RegionAndName key = new RegionAndName("us-east-1", node.getProviderId()); String val = "1.1.1.1"; LoadingCache<RegionAndName, String> cache = cacheOf(key, val); AddElasticIpsToNodemetadata fn = new AddElasticIpsToNodemetadata(cache); assertEquals(fn.apply( NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.<String> of()).build()) .getPublicAddresses(), ImmutableSet.of("1.1.1.1")); }