From 7794eacc91767a9a4b42e7386ba4fcaa1e1e0b9d Mon Sep 17 00:00:00 2001 From: Nikolay Martynov Date: Tue, 17 Jul 2018 15:30:21 -0400 Subject: [PATCH] Increase Cassandra request timeout in tests --- .../src/test/groovy/CassandraClientTest.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/dd-java-agent/instrumentation/datastax-cassandra-3.2/src/test/groovy/CassandraClientTest.groovy b/dd-java-agent/instrumentation/datastax-cassandra-3.2/src/test/groovy/CassandraClientTest.groovy index 54a33fd29f..35b86a5d1a 100644 --- a/dd-java-agent/instrumentation/datastax-cassandra-3.2/src/test/groovy/CassandraClientTest.groovy +++ b/dd-java-agent/instrumentation/datastax-cassandra-3.2/src/test/groovy/CassandraClientTest.groovy @@ -5,9 +5,13 @@ import datadog.trace.agent.test.AgentTestRunner import datadog.trace.api.DDTags import io.opentracing.tag.Tags import org.cassandraunit.utils.EmbeddedCassandraServerHelper +import spock.lang.Shared class CassandraClientTest extends AgentTestRunner { + @Shared + Cluster cluster + def setupSpec() { /* This timeout seems excessive but we've seen tests fail with timeout of 40s. @@ -16,6 +20,14 @@ class CassandraClientTest extends AgentTestRunner { tests would have to assume they run under shared Cassandra and act accordingly. */ EmbeddedCassandraServerHelper.startEmbeddedCassandra(120000L) + + cluster = EmbeddedCassandraServerHelper.getCluster() + + /* + Looks like sometimes our requests fail because Cassandra takes to long to respond, + Increase this timeout as well to try to cope with this. + */ + cluster.getConfiguration().getSocketOptions().setReadTimeoutMillis(120000) } def cleanupSpec() { @@ -24,7 +36,6 @@ class CassandraClientTest extends AgentTestRunner { def "sync traces"() { setup: - final Cluster cluster = EmbeddedCassandraServerHelper.getCluster() final Session session = cluster.newSession() session.execute("DROP KEYSPACE IF EXISTS sync_test") @@ -57,7 +68,6 @@ class CassandraClientTest extends AgentTestRunner { def "async traces"() { setup: - final Cluster cluster = EmbeddedCassandraServerHelper.getCluster() final Session session = cluster.connectAsync().get() session.executeAsync("DROP KEYSPACE IF EXISTS async_test").get()