use of org.elasticsearch.common.network.NetworkService in project elasticsearch by elastic.
the class FileBasedUnicastHostsProviderTests method createTransportSvc.
@Before
public void createTransportSvc() {
MockTcpTransport transport = new MockTcpTransport(Settings.EMPTY, threadPool, BigArrays.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService(), new NamedWriteableRegistry(Collections.emptyList()), new NetworkService(Settings.EMPTY, Collections.emptyList())) {
@Override
public BoundTransportAddress boundAddress() {
return new BoundTransportAddress(new TransportAddress[] { new TransportAddress(InetAddress.getLoopbackAddress(), 9300) }, new TransportAddress(InetAddress.getLoopbackAddress(), 9300));
}
};
transportService = new MockTransportService(Settings.EMPTY, transport, threadPool, TransportService.NOOP_TRANSPORT_INTERCEPTOR, null);
}
use of org.elasticsearch.common.network.NetworkService 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.common.network.NetworkService 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.common.network.NetworkService 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.common.network.NetworkService 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_" })));
}
Aggregations