@Test(groups = "Integration") public void testHostsAgreeOnExternalIp() { Set<String> ips = Sets.newHashSet(); for (String url : LocalhostExternalIpLoader.getIpAddressWebsites()) { String ip = LocalhostExternalIpLoader.getIpAddressFrom(url); LOG.debug("IP from {}: {}", url, ip); ips.add(ip); } assertEquals( ips.size(), 1, "Expected all IP suppliers to agree on the external IP address of Brooklyn. " + "Check logs for source responses. ips=" + ips); }
@Override public Cidr get() { Cidr local = cidr; if (local == null) { synchronized (this) { local = cidr; if (local == null) { String externalIp = LocalhostExternalIpLoader.getLocalhostIpWithin(Duration.seconds(5)); cidr = local = new Cidr(externalIp + "/32"); } } } return local; }
@Test(groups = "Integration") public void testLoadExternalIp() { assertNotNull(LocalhostExternalIpLoader.getLocalhostIpWaiting()); }