use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostEc2.
/**
* Test for network.host: _ec2_
*/
public void testNetworkHostEc2() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2_").build();
NetworkService networkService = new NetworkService(nodeSettings, Collections.singletonList(new Ec2NameResolver(nodeSettings)));
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
try {
networkService.resolveBindHostAddresses(null);
} catch (IOException e) {
assertThat(e.getMessage(), containsString("local-ipv4"));
}
}
use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostEc2PrivateIp.
/**
* Test for network.host: _ec2:privateIp_
*/
public void testNetworkHostEc2PrivateIp() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2:privateIp_").build();
NetworkService networkService = new NetworkService(nodeSettings, Collections.singletonList(new Ec2NameResolver(nodeSettings)));
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
try {
networkService.resolveBindHostAddresses(null);
} catch (IOException e) {
assertThat(e.getMessage(), containsString("local-ipv4"));
}
}
use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostEc2PublicIpv4.
/**
* Test for network.host: _ec2:publicIpv4_
*/
public void testNetworkHostEc2PublicIpv4() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2:publicIpv4_").build();
NetworkService networkService = new NetworkService(nodeSettings, Collections.singletonList(new Ec2NameResolver(nodeSettings)));
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
try {
networkService.resolveBindHostAddresses(null);
} catch (IOException e) {
assertThat(e.getMessage(), containsString("public-ipv4"));
}
}
use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostCoreLocal.
/**
* Test that we don't have any regression with network host core settings such as
* network.host: _local_
*/
public void testNetworkHostCoreLocal() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_local_").build();
NetworkService networkService = new NetworkService(nodeSettings, Collections.singletonList(new Ec2NameResolver(nodeSettings)));
InetAddress[] addresses = networkService.resolveBindHostAddresses(null);
assertThat(addresses, arrayContaining(networkService.resolveBindHostAddresses(new String[] { "_local_" })));
}
use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostEc2PrivateIpv4.
/**
* Test for network.host: _ec2:privateIpv4_
*/
public void testNetworkHostEc2PrivateIpv4() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2:privateIpv4_").build();
NetworkService networkService = new NetworkService(nodeSettings, Collections.singletonList(new Ec2NameResolver(nodeSettings)));
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
try {
networkService.resolveBindHostAddresses(null);
} catch (IOException e) {
assertThat(e.getMessage(), containsString("local-ipv4"));
}
}
Aggregations