Increase Cassandra request timeout in tests

This commit is contained in:
Nikolay Martynov 2018-07-17 15:30:21 -04:00
parent a8af78ae18
commit 7794eacc91
1 changed files with 12 additions and 2 deletions

View File

@ -5,9 +5,13 @@ import datadog.trace.agent.test.AgentTestRunner
import datadog.trace.api.DDTags import datadog.trace.api.DDTags
import io.opentracing.tag.Tags import io.opentracing.tag.Tags
import org.cassandraunit.utils.EmbeddedCassandraServerHelper import org.cassandraunit.utils.EmbeddedCassandraServerHelper
import spock.lang.Shared
class CassandraClientTest extends AgentTestRunner { class CassandraClientTest extends AgentTestRunner {
@Shared
Cluster cluster
def setupSpec() { def setupSpec() {
/* /*
This timeout seems excessive but we've seen tests fail with timeout of 40s. 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. tests would have to assume they run under shared Cassandra and act accordingly.
*/ */
EmbeddedCassandraServerHelper.startEmbeddedCassandra(120000L) 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() { def cleanupSpec() {
@ -24,7 +36,6 @@ class CassandraClientTest extends AgentTestRunner {
def "sync traces"() { def "sync traces"() {
setup: setup:
final Cluster cluster = EmbeddedCassandraServerHelper.getCluster()
final Session session = cluster.newSession() final Session session = cluster.newSession()
session.execute("DROP KEYSPACE IF EXISTS sync_test") session.execute("DROP KEYSPACE IF EXISTS sync_test")
@ -57,7 +68,6 @@ class CassandraClientTest extends AgentTestRunner {
def "async traces"() { def "async traces"() {
setup: setup:
final Cluster cluster = EmbeddedCassandraServerHelper.getCluster()
final Session session = cluster.connectAsync().get() final Session session = cluster.connectAsync().get()
session.executeAsync("DROP KEYSPACE IF EXISTS async_test").get() session.executeAsync("DROP KEYSPACE IF EXISTS async_test").get()