Make ES tests more deterministic by using listener pool with 1 thread
This should reduce number of false negatives in ES tests
MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-2/src/test/groovy/Elasticsearch2NodeClientTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-2/src/test/groovy/Elasticsearch2NodeClientTest.groovy
@@ -34,6 +34,8 @@ class Elasticsearch2NodeClientTest extends AgentTestRunner {
def settings = Settings.builder()
.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)
.build()

MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-2/src/test/groovy/Elasticsearch2SpringTemplateTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-2/src/test/groovy/Elasticsearch2SpringTemplateTest.groovy
@@ -45,6 +45,8 @@ class Elasticsearch2SpringTemplateTest extends AgentTestRunner {
def settings = Settings.builder()
.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)
.build()

MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-2/src/test/groovy/Elasticsearch2TransportClientTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-2/src/test/groovy/Elasticsearch2TransportClientTest.groovy
@@ -46,6 +46,8 @@ class Elasticsearch2TransportClientTest extends AgentTestRunner {
client = TransportClient.builder().settings(
Settings.builder()
+ // 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("cluster.name", "test-cluster")
.build()
).build()

MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-5/src/test/groovy/Elasticsearch5NodeClientTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-5/src/test/groovy/Elasticsearch5NodeClientTest.groovy
@@ -37,6 +37,8 @@ class Elasticsearch5NodeClientTest extends AgentTestRunner {
def settings = Settings.builder()
.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("transport.type", "netty3")

MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-5/src/test/groovy/Elasticsearch5TransportClientTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-5/src/test/groovy/Elasticsearch5TransportClientTest.groovy
@@ -53,6 +53,8 @@ class Elasticsearch5TransportClientTest extends AgentTestRunner {
client = new PreBuiltTransportClient(
Settings.builder()
+ // 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(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
.build()
)

MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-6/src/test/groovy/Elasticsearch6NodeClientTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-6/src/test/groovy/Elasticsearch6NodeClientTest.groovy
@@ -36,6 +36,8 @@ class Elasticsearch6NodeClientTest extends AgentTestRunner {
def settings = Settings.builder()
.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(CLUSTER_NAME_SETTING.getKey(), "test-cluster")

MODIFY
dd-java-agent/instrumentation/elasticsearch-transport-6/src/test/groovy/Elasticsearch6TransportClientTest.groovy
dd-java-agent/instrumentation/elasticsearch-transport-6/src/test/groovy/Elasticsearch6TransportClientTest.groovy
@@ -50,6 +50,8 @@ class Elasticsearch6TransportClientTest extends AgentTestRunner {
client = new PreBuiltTransportClient(
Settings.builder()
+ // 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(CLUSTER_NAME_SETTING.getKey(), "test-cluster")
.build()
)

Make ES tests more deterministic by using listener pool with 1 thread

This should reduce number of false negatives in ES tests