Improve tmp dir handling in ES tests
Also make sure ES ports are allocated right before ES is started
This commit is contained in:
parent
df53d6b0c6
commit
c3825d9d52
|
@ -22,33 +22,36 @@ class Elasticsearch6RestClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
@Shared
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static RestClient client
|
||||
RestClient client
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
def settings = Settings.builder()
|
||||
.put("path.home", esWorkingDir.path)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.put("cluster.name", "test-cluster")
|
||||
.build()
|
||||
testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin])
|
||||
testNode.start()
|
||||
|
||||
client = RestClient.builder(new HttpHost("localhost", HTTP_PORT))
|
||||
client = RestClient.builder(new HttpHost("localhost", httpPort))
|
||||
.setMaxRetryTimeoutMillis(Integer.MAX_VALUE)
|
||||
.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
|
||||
@Override
|
||||
|
@ -107,7 +110,7 @@ class Elasticsearch6RestClientTest extends AgentTestRunner {
|
|||
"$Tags.HTTP_METHOD.key" "GET"
|
||||
"$Tags.HTTP_URL.key" "_cluster/health"
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_PORT.key" HTTP_PORT
|
||||
"$Tags.PEER_PORT.key" httpPort
|
||||
defaultTags()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,27 +24,30 @@ class Elasticsearch5RestClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static RestClient client
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
def settings = Settings.builder()
|
||||
.put("path.home", esWorkingDir.path)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.put("transport.type", "netty3")
|
||||
.put("http.type", "netty3")
|
||||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
|
@ -52,7 +55,7 @@ class Elasticsearch5RestClientTest extends AgentTestRunner {
|
|||
testNode = new Node(new Environment(InternalSettingsPreparer.prepareSettings(settings)), [Netty3Plugin])
|
||||
testNode.start()
|
||||
|
||||
client = RestClient.builder(new HttpHost("localhost", HTTP_PORT))
|
||||
client = RestClient.builder(new HttpHost("localhost", httpPort))
|
||||
.setMaxRetryTimeoutMillis(Integer.MAX_VALUE)
|
||||
.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
|
||||
@Override
|
||||
|
@ -95,7 +98,7 @@ class Elasticsearch5RestClientTest extends AgentTestRunner {
|
|||
"$Tags.HTTP_METHOD.key" "GET"
|
||||
"$Tags.HTTP_URL.key" "_cluster/health"
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_PORT.key" HTTP_PORT
|
||||
"$Tags.PEER_PORT.key" httpPort
|
||||
defaultTags()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,19 +16,22 @@ class Elasticsearch2NodeClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
def client = testNode.client()
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
|
@ -36,8 +39,8 @@ class Elasticsearch2NodeClientTest extends AgentTestRunner {
|
|||
.put("path.home", esWorkingDir.path)
|
||||
// Since we use listeners to close spans this should make our span closing deterministic which is good for tests
|
||||
.put("thread_pool.listener.size", 1)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.build()
|
||||
testNode = NodeBuilder.newInstance().local(true).clusterName("test-cluster").settings(settings).build()
|
||||
testNode.start()
|
||||
|
|
|
@ -26,20 +26,23 @@ class Elasticsearch2SpringTemplateTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
@Shared
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static ElasticsearchTemplate template
|
||||
ElasticsearchTemplate template
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
|
@ -47,8 +50,8 @@ class Elasticsearch2SpringTemplateTest extends AgentTestRunner {
|
|||
.put("path.home", esWorkingDir.path)
|
||||
// Since we use listeners to close spans this should make our span closing deterministic which is good for tests
|
||||
.put("thread_pool.listener.size", 1)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.build()
|
||||
testNode = NodeBuilder.newInstance().local(true).clusterName("test-cluster").settings(settings).build()
|
||||
testNode.start()
|
||||
|
|
|
@ -19,27 +19,30 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
@Shared
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static TransportClient client
|
||||
TransportClient client
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
def settings = Settings.builder()
|
||||
.put("path.home", esWorkingDir.path)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.build()
|
||||
testNode = NodeBuilder.newInstance().clusterName("test-cluster").settings(settings).build()
|
||||
testNode.start()
|
||||
|
@ -51,7 +54,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
.put("cluster.name", "test-cluster")
|
||||
.build()
|
||||
).build()
|
||||
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), TCP_PORT))
|
||||
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), tcpPort))
|
||||
TEST_WRITER.clear()
|
||||
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet(5000)
|
||||
TEST_WRITER.waitForTraces(1)
|
||||
|
@ -87,7 +90,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "ClusterHealthAction"
|
||||
"elasticsearch.request" "ClusterHealthRequest"
|
||||
defaultTags()
|
||||
|
@ -185,7 +188,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
"elasticsearch.request.indices" indexName
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
defaultTags()
|
||||
}
|
||||
}
|
||||
|
@ -203,7 +206,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
"elasticsearch.request" "ClusterHealthRequest"
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
defaultTags()
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +222,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "GetAction"
|
||||
"elasticsearch.request" "GetRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -257,7 +260,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "IndexAction"
|
||||
"elasticsearch.request" "IndexRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -277,7 +280,7 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "GetAction"
|
||||
"elasticsearch.request" "GetRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
|
|
@ -19,19 +19,22 @@ class Elasticsearch5NodeClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
def client = testNode.client()
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
|
@ -39,8 +42,8 @@ class Elasticsearch5NodeClientTest extends AgentTestRunner {
|
|||
.put("path.home", esWorkingDir.path)
|
||||
// Since we use listeners to close spans this should make our span closing deterministic which is good for tests
|
||||
.put("thread_pool.listener.size", 1)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.put("transport.type", "netty3")
|
||||
.put("http.type", "netty3")
|
||||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
|
|
|
@ -23,27 +23,30 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
@Shared
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static TransportClient client
|
||||
TransportClient client
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
def settings = Settings.builder()
|
||||
.put("path.home", esWorkingDir.path)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.put("transport.type", "netty3")
|
||||
.put("http.type", "netty3")
|
||||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
|
@ -58,7 +61,7 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
.build()
|
||||
)
|
||||
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), TCP_PORT))
|
||||
client.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName("localhost"), tcpPort))
|
||||
TEST_WRITER.clear()
|
||||
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet(5000)
|
||||
TEST_WRITER.waitForTraces(1)
|
||||
|
@ -94,7 +97,7 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "ClusterHealthAction"
|
||||
"elasticsearch.request" "ClusterHealthRequest"
|
||||
defaultTags()
|
||||
|
@ -192,7 +195,7 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
"elasticsearch.request.indices" indexName
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
defaultTags()
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +211,7 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "GetAction"
|
||||
"elasticsearch.request" "GetRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -245,7 +248,7 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "IndexAction"
|
||||
"elasticsearch.request" "IndexRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -270,7 +273,7 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "127.0.0.1"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "GetAction"
|
||||
"elasticsearch.request" "GetRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
|
|
@ -18,19 +18,22 @@ class Elasticsearch6NodeClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
def client = testNode.client()
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
|
@ -38,8 +41,8 @@ class Elasticsearch6NodeClientTest extends AgentTestRunner {
|
|||
.put("path.home", esWorkingDir.path)
|
||||
// Since we use listeners to close spans this should make our span closing deterministic which is good for tests
|
||||
.put("thread_pool.listener.size", 1)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
.build()
|
||||
testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin])
|
||||
|
|
|
@ -22,27 +22,30 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
System.setProperty("dd.integration.elasticsearch.enabled", "true")
|
||||
}
|
||||
|
||||
static final int HTTP_PORT = TestUtils.randomOpenPort()
|
||||
static final int TCP_PORT = TestUtils.randomOpenPort()
|
||||
@Shared
|
||||
int httpPort
|
||||
@Shared
|
||||
int tcpPort
|
||||
@Shared
|
||||
Node testNode
|
||||
@Shared
|
||||
File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static Node testNode
|
||||
static File esWorkingDir
|
||||
|
||||
@Shared
|
||||
static TransportClient client
|
||||
TransportClient client
|
||||
|
||||
def setupSpec() {
|
||||
esWorkingDir = File.createTempFile("test-es-working-dir-", "")
|
||||
esWorkingDir.delete()
|
||||
esWorkingDir.mkdir()
|
||||
httpPort = TestUtils.randomOpenPort()
|
||||
tcpPort = TestUtils.randomOpenPort()
|
||||
|
||||
esWorkingDir = File.createTempDir("test-es-working-dir-", "")
|
||||
esWorkingDir.deleteOnExit()
|
||||
println "ES work dir: $esWorkingDir"
|
||||
|
||||
def settings = Settings.builder()
|
||||
.put("path.home", esWorkingDir.path)
|
||||
.put("http.port", HTTP_PORT)
|
||||
.put("transport.tcp.port", TCP_PORT)
|
||||
.put("http.port", httpPort)
|
||||
.put("transport.tcp.port", tcpPort)
|
||||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
.build()
|
||||
testNode = new Node(InternalSettingsPreparer.prepareEnvironment(settings, null), [Netty4Plugin])
|
||||
|
@ -55,7 +58,7 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
.put(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
|
||||
.build()
|
||||
)
|
||||
client.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), TCP_PORT))
|
||||
client.addTransportAddress(new TransportAddress(InetAddress.getByName("localhost"), tcpPort))
|
||||
TEST_WRITER.clear()
|
||||
client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet(5000)
|
||||
TEST_WRITER.waitForTraces(1)
|
||||
|
@ -90,7 +93,7 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "ClusterHealthAction"
|
||||
"elasticsearch.request" "ClusterHealthRequest"
|
||||
defaultTags()
|
||||
|
@ -185,7 +188,7 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "CreateIndexAction"
|
||||
"elasticsearch.request" "CreateIndexRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -204,7 +207,7 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "GetAction"
|
||||
"elasticsearch.request" "GetRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -241,7 +244,7 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "IndexAction"
|
||||
"elasticsearch.request" "IndexRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
@ -267,7 +270,7 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
|
|||
"$Tags.SPAN_KIND.key" Tags.SPAN_KIND_CLIENT
|
||||
"$Tags.PEER_HOSTNAME.key" "localhost"
|
||||
"$Tags.PEER_HOST_IPV4.key" "127.0.0.1"
|
||||
"$Tags.PEER_PORT.key" TCP_PORT
|
||||
"$Tags.PEER_PORT.key" tcpPort
|
||||
"elasticsearch.action" "GetAction"
|
||||
"elasticsearch.request" "GetRequest"
|
||||
"elasticsearch.request.indices" indexName
|
||||
|
|
Loading…
Reference in New Issue