Skip to content

Commit

Permalink
Fix test flakiness for redisson
Browse files Browse the repository at this point in the history
  • Loading branch information
amarziali committed Sep 10, 2024
1 parent ff190af commit c9ca2e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import static datadog.trace.agent.test.utils.TraceUtils.runUnderTrace
import static datadog.trace.api.config.TraceInstrumentationConfig.DB_CLIENT_HOST_SPLIT_BY_INSTANCE
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.activeSpan

import com.redis.testcontainers.RedisContainer
import com.redis.testcontainers.RedisServer
Expand Down Expand Up @@ -54,17 +52,15 @@ abstract class RedissonClientTest extends VersionedNamingTestBase {
}

def setup() {
def cleanupSpan = runUnderTrace("cleanup") {
activeSpan()
}
TEST_WRITER.waitUntilReported(cleanupSpan)
TEST_WRITER.start()
}

def cleanup() {
RedisConnection conn = lowLevelRedisClient.connect()
conn.sync(RedisCommands.FLUSHDB)
conn.closeAsync().await()
try (def suppressScope = TEST_TRACER.muteTracing()) {
RedisConnection conn = lowLevelRedisClient.connect()
conn.sync(RedisCommands.FLUSHDB)
conn.closeAsync().await()
}
}

def "bucket set command"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,13 @@ abstract class RedissonClientTest extends VersionedNamingTestBase {
}

def setup() {
def cleanupSpan = runUnderTrace("cleanup") {
activeSpan()
}
TEST_WRITER.waitUntilReported(cleanupSpan)
TEST_WRITER.start()
}

def cleanup() {
redissonClient.getKeys().flushdb()
try (def suppressScope = TEST_TRACER.muteTracing()) {
redissonClient.getKeys().flushdb()
}
}

def "bucket set command"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ abstract class RedissonClientTest extends VersionedNamingTestBase {
}

def setup() {
def cleanupSpan = runUnderTrace("cleanup") {
activeSpan()
}
TEST_WRITER.waitUntilReported(cleanupSpan)
TEST_WRITER.start()
}

def cleanup() {
redissonClient.getKeys().flushdb()
try (def suppressScope = TEST_TRACER.muteTracing()) {
redissonClient.getKeys().flushdb()
}
}
def "bucket set command"() {
when:
Expand Down

0 comments on commit c9ca2e1

Please sign in to comment.