Lettuce: properly close connection instead of letting it being GCed
This commit is contained in:
parent
b0c2ab9b68
commit
21d58768cb
|
@ -54,6 +54,8 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
|||
@Shared
|
||||
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
||||
|
||||
@Shared
|
||||
StatefulConnection connection
|
||||
@Shared
|
||||
RedisAsyncCommands<String, ?> asyncCommands = null
|
||||
|
||||
|
@ -67,11 +69,14 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
|||
def setupSpec() {
|
||||
println "Using redis: $redisServer.args"
|
||||
redisServer.start()
|
||||
StatefulConnection connection = redisClient.connect()
|
||||
connection = redisClient.connect()
|
||||
asyncCommands = connection.async()
|
||||
TEST_WRITER.waitForTraces(1)
|
||||
TEST_WRITER.clear()
|
||||
}
|
||||
|
||||
def cleanupSpec() {
|
||||
connection.close()
|
||||
redisServer.stop()
|
||||
}
|
||||
|
||||
|
|
|
@ -37,17 +37,22 @@ class LettuceReactiveClientTest extends AgentTestRunner {
|
|||
@Shared
|
||||
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
||||
|
||||
@Shared
|
||||
StatefulConnection connection
|
||||
@Shared
|
||||
RedisReactiveCommands<String, ?> reactiveCommands = null
|
||||
|
||||
def setupSpec() {
|
||||
println "Using redis: $redisServer.args"
|
||||
redisServer.start()
|
||||
StatefulConnection connection = redisClient.connect()
|
||||
connection = redisClient.connect()
|
||||
reactiveCommands = connection.reactive()
|
||||
TEST_WRITER.waitForTraces(1)
|
||||
TEST_WRITER.clear()
|
||||
}
|
||||
|
||||
def cleanupSpec() {
|
||||
connection.close()
|
||||
redisServer.stop()
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ class LettuceSyncClientTest extends AgentTestRunner {
|
|||
@Shared
|
||||
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
||||
|
||||
@Shared
|
||||
StatefulConnection connection
|
||||
@Shared
|
||||
RedisCommands<String, ?> syncCommands = null
|
||||
|
||||
|
@ -54,13 +56,14 @@ class LettuceSyncClientTest extends AgentTestRunner {
|
|||
|
||||
def setupSpec() {
|
||||
redisServer.start()
|
||||
StatefulConnection connection = redisClient.connect()
|
||||
connection = redisClient.connect()
|
||||
syncCommands = connection.sync()
|
||||
TEST_WRITER.waitForTraces(1)
|
||||
TEST_WRITER.clear()
|
||||
}
|
||||
|
||||
def cleanupSpec() {
|
||||
connection.close()
|
||||
redisServer.stop()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue