use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostEc2PublicDns.
/**
* Test for network.host: _ec2:publicDns_
*/
public void testNetworkHostEc2PublicDns() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2:publicDns_").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-hostname"));
}
}
use of org.elasticsearch.cloud.aws.network.Ec2NameResolver in project elasticsearch by elastic.
the class Ec2NetworkTests method testNetworkHostEc2PublicIp.
/**
* Test for network.host: _ec2:publicIp_
*/
public void testNetworkHostEc2PublicIp() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2:publicIp_").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 testNetworkHostEc2PrivateDns.
/**
* Test for network.host: _ec2:privateDns_
*/
public void testNetworkHostEc2PrivateDns() throws IOException {
Settings nodeSettings = Settings.builder().put("network.host", "_ec2:privateDns_").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-hostname"));
}
}
Aggregations