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
|
@Shared
|
||||||
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
||||||
|
|
||||||
|
@Shared
|
||||||
|
StatefulConnection connection
|
||||||
@Shared
|
@Shared
|
||||||
RedisAsyncCommands<String, ?> asyncCommands = null
|
RedisAsyncCommands<String, ?> asyncCommands = null
|
||||||
|
|
||||||
|
@ -67,11 +69,14 @@ class LettuceAsyncClientTest extends AgentTestRunner {
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
println "Using redis: $redisServer.args"
|
println "Using redis: $redisServer.args"
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
StatefulConnection connection = redisClient.connect()
|
connection = redisClient.connect()
|
||||||
asyncCommands = connection.async()
|
asyncCommands = connection.async()
|
||||||
|
TEST_WRITER.waitForTraces(1)
|
||||||
|
TEST_WRITER.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
connection.close()
|
||||||
redisServer.stop()
|
redisServer.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,17 +37,22 @@ class LettuceReactiveClientTest extends AgentTestRunner {
|
||||||
@Shared
|
@Shared
|
||||||
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
||||||
|
|
||||||
|
@Shared
|
||||||
|
StatefulConnection connection
|
||||||
@Shared
|
@Shared
|
||||||
RedisReactiveCommands<String, ?> reactiveCommands = null
|
RedisReactiveCommands<String, ?> reactiveCommands = null
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
println "Using redis: $redisServer.args"
|
println "Using redis: $redisServer.args"
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
StatefulConnection connection = redisClient.connect()
|
connection = redisClient.connect()
|
||||||
reactiveCommands = connection.reactive()
|
reactiveCommands = connection.reactive()
|
||||||
|
TEST_WRITER.waitForTraces(1)
|
||||||
|
TEST_WRITER.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
connection.close()
|
||||||
redisServer.stop()
|
redisServer.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,8 @@ class LettuceSyncClientTest extends AgentTestRunner {
|
||||||
@Shared
|
@Shared
|
||||||
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
RedisClient redisClient = RedisClient.create(EMBEDDED_DB_URI)
|
||||||
|
|
||||||
|
@Shared
|
||||||
|
StatefulConnection connection
|
||||||
@Shared
|
@Shared
|
||||||
RedisCommands<String, ?> syncCommands = null
|
RedisCommands<String, ?> syncCommands = null
|
||||||
|
|
||||||
|
@ -54,13 +56,14 @@ class LettuceSyncClientTest extends AgentTestRunner {
|
||||||
|
|
||||||
def setupSpec() {
|
def setupSpec() {
|
||||||
redisServer.start()
|
redisServer.start()
|
||||||
StatefulConnection connection = redisClient.connect()
|
connection = redisClient.connect()
|
||||||
syncCommands = connection.sync()
|
syncCommands = connection.sync()
|
||||||
TEST_WRITER.waitForTraces(1)
|
TEST_WRITER.waitForTraces(1)
|
||||||
TEST_WRITER.clear()
|
TEST_WRITER.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
def cleanupSpec() {
|
def cleanupSpec() {
|
||||||
|
connection.close()
|
||||||
redisServer.stop()
|
redisServer.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue