Skip to content

Commit

Permalink
Retry open connection on lettuce 5 tests (#8145)
Browse files Browse the repository at this point in the history
  • Loading branch information
amarziali authored Jan 3, 2025
1 parent 1951e6f commit 865594b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import datadog.trace.api.DDSpanTypes
import datadog.trace.bootstrap.instrumentation.api.Tags
import io.lettuce.core.ClientOptions
import io.lettuce.core.RedisClient
import io.lettuce.core.api.StatefulConnection
import io.lettuce.core.api.StatefulRedisConnection
import io.lettuce.core.api.reactive.RedisReactiveCommands
import io.lettuce.core.api.sync.RedisCommands
import org.testcontainers.containers.wait.strategy.Wait
import reactor.core.scheduler.Schedulers
import spock.lang.Shared
import spock.util.concurrent.AsyncConditions
import spock.util.concurrent.PollingConditions

import java.util.function.Consumer

Expand All @@ -40,7 +41,7 @@ abstract class Lettuce5ReactiveClientTest extends VersionedNamingTestBase {
.waitingFor(Wait.forListeningPort())

RedisClient redisClient
StatefulConnection connection
StatefulRedisConnection connection
RedisReactiveCommands<String, ?> reactiveCommands
RedisCommands<String, ?> syncCommands

Expand All @@ -54,7 +55,9 @@ abstract class Lettuce5ReactiveClientTest extends VersionedNamingTestBase {

redisClient.setOptions(CLIENT_OPTIONS)

connection = redisClient.connect()
new PollingConditions(delay: 3, timeout: 15).eventually {
(connection = redisClient.connect()) != null
}
reactiveCommands = connection.reactive()
syncCommands = connection.sync()

Expand Down

0 comments on commit 865594b

Please sign in to comment.