Test: make httpClient() helper not rely on internalCluster (which may be read only)
This commit is contained in:
parent
eed7c8af6d
commit
9c209e46be
|
@ -1947,7 +1947,13 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
protected HttpRequestBuilder httpClient() {
|
protected HttpRequestBuilder httpClient() {
|
||||||
return new HttpRequestBuilder(HttpClients.createDefault()).httpTransport(internalCluster().getDataNodeInstance(HttpServerTransport.class));
|
final NodesInfoResponse nodeInfos = client().admin().cluster().prepareNodesInfo().get();
|
||||||
|
final NodeInfo[] nodes = nodeInfos.getNodes();
|
||||||
|
assertTrue(nodes.length > 0);
|
||||||
|
TransportAddress publishAddress = randomFrom(nodes).getHttp().address().publishAddress();
|
||||||
|
assertEquals(1, publishAddress.uniqueAddressTypeId());
|
||||||
|
InetSocketAddress address = ((InetSocketTransportAddress) publishAddress).address();
|
||||||
|
return new HttpRequestBuilder(HttpClients.createDefault()).host(address.getHostName()).port(address.getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue