Shut down lettuce RedisClient (#9537)
This commit is contained in:
parent
0dfbd78597
commit
a3474545f3
|
@ -103,12 +103,14 @@ class LettuceAsyncClientTest {
|
||||||
syncCommands.set("TESTKEY", "TESTVAL");
|
syncCommands.set("TESTKEY", "TESTVAL");
|
||||||
|
|
||||||
// 1 set + 1 connect trace
|
// 1 set + 1 connect trace
|
||||||
|
testing.waitForTraces(2);
|
||||||
testing.clearData();
|
testing.clearData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterAll
|
||||||
static void cleanUp() {
|
static void cleanUp() {
|
||||||
connection.close();
|
connection.close();
|
||||||
|
redisClient.shutdown();
|
||||||
redisServer.stop();
|
redisServer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,6 +123,7 @@ class LettuceAsyncClientTest {
|
||||||
testConnectionClient.connect(
|
testConnectionClient.connect(
|
||||||
new Utf8StringCodec(), new RedisURI(host, port, 3, TimeUnit.SECONDS));
|
new Utf8StringCodec(), new RedisURI(host, port, 3, TimeUnit.SECONDS));
|
||||||
cleanup.deferCleanup(connection1);
|
cleanup.deferCleanup(connection1);
|
||||||
|
cleanup.deferCleanup(testConnectionClient::shutdown);
|
||||||
|
|
||||||
assertThat(connection1).isNotNull();
|
assertThat(connection1).isNotNull();
|
||||||
|
|
||||||
|
@ -140,6 +143,7 @@ class LettuceAsyncClientTest {
|
||||||
void testExceptionInsideTheConnectionFuture() {
|
void testExceptionInsideTheConnectionFuture() {
|
||||||
RedisClient testConnectionClient = RedisClient.create(dbUriNonExistent);
|
RedisClient testConnectionClient = RedisClient.create(dbUriNonExistent);
|
||||||
testConnectionClient.setOptions(CLIENT_OPTIONS);
|
testConnectionClient.setOptions(CLIENT_OPTIONS);
|
||||||
|
cleanup.deferCleanup(testConnectionClient::shutdown);
|
||||||
|
|
||||||
Exception exception =
|
Exception exception =
|
||||||
catchException(
|
catchException(
|
||||||
|
@ -460,11 +464,14 @@ class LettuceAsyncClientTest {
|
||||||
|
|
||||||
long serverPort = server.getMappedPort(6379);
|
long serverPort = server.getMappedPort(6379);
|
||||||
RedisClient client = RedisClient.create("redis://" + host + ":" + serverPort + "/" + DB_INDEX);
|
RedisClient client = RedisClient.create("redis://" + host + ":" + serverPort + "/" + DB_INDEX);
|
||||||
|
client.setOptions(CLIENT_OPTIONS);
|
||||||
StatefulRedisConnection<String, String> connection1 = client.connect();
|
StatefulRedisConnection<String, String> connection1 = client.connect();
|
||||||
cleanup.deferCleanup(connection1);
|
cleanup.deferCleanup(connection1);
|
||||||
|
cleanup.deferCleanup(client::shutdown);
|
||||||
|
|
||||||
RedisAsyncCommands<String, String> commands = connection1.async();
|
RedisAsyncCommands<String, String> commands = connection1.async();
|
||||||
// 1 connect trace
|
// 1 connect trace
|
||||||
|
testing.waitForTraces(1);
|
||||||
testing.clearData();
|
testing.clearData();
|
||||||
|
|
||||||
commands.debugSegfault();
|
commands.debugSegfault();
|
||||||
|
@ -491,11 +498,14 @@ class LettuceAsyncClientTest {
|
||||||
|
|
||||||
RedisClient client =
|
RedisClient client =
|
||||||
RedisClient.create("redis://" + host + ":" + shutdownServerPort + "/" + DB_INDEX);
|
RedisClient.create("redis://" + host + ":" + shutdownServerPort + "/" + DB_INDEX);
|
||||||
|
client.setOptions(CLIENT_OPTIONS);
|
||||||
StatefulRedisConnection<String, String> connection1 = client.connect();
|
StatefulRedisConnection<String, String> connection1 = client.connect();
|
||||||
cleanup.deferCleanup(connection1);
|
cleanup.deferCleanup(connection1);
|
||||||
|
cleanup.deferCleanup(client::shutdown);
|
||||||
|
|
||||||
RedisAsyncCommands<String, String> commands = connection1.async();
|
RedisAsyncCommands<String, String> commands = connection1.async();
|
||||||
// 1 connect trace
|
// 1 connect trace
|
||||||
|
testing.waitForTraces(1);
|
||||||
testing.clearData();
|
testing.clearData();
|
||||||
|
|
||||||
commands.shutdown(false);
|
commands.shutdown(false);
|
||||||
|
|
|
@ -92,6 +92,7 @@ class LettuceSyncClientTest {
|
||||||
@AfterAll
|
@AfterAll
|
||||||
static void cleanUp() {
|
static void cleanUp() {
|
||||||
connection.close();
|
connection.close();
|
||||||
|
redisClient.shutdown();
|
||||||
redisServer.stop();
|
redisServer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +103,7 @@ class LettuceSyncClientTest {
|
||||||
|
|
||||||
StatefulRedisConnection<String, String> testConnection = testConnectionClient.connect();
|
StatefulRedisConnection<String, String> testConnection = testConnectionClient.connect();
|
||||||
cleanup.deferCleanup(() -> testConnection.close());
|
cleanup.deferCleanup(() -> testConnection.close());
|
||||||
|
cleanup.deferCleanup(testConnectionClient::shutdown);
|
||||||
|
|
||||||
testing.waitAndAssertTraces(
|
testing.waitAndAssertTraces(
|
||||||
trace ->
|
trace ->
|
||||||
|
@ -119,6 +121,7 @@ class LettuceSyncClientTest {
|
||||||
void testConnectException() {
|
void testConnectException() {
|
||||||
RedisClient testConnectionClient = RedisClient.create(dbUriNonExistent);
|
RedisClient testConnectionClient = RedisClient.create(dbUriNonExistent);
|
||||||
testConnectionClient.setOptions(CLIENT_OPTIONS);
|
testConnectionClient.setOptions(CLIENT_OPTIONS);
|
||||||
|
cleanup.deferCleanup(testConnectionClient::shutdown);
|
||||||
|
|
||||||
Exception exception = catchException(testConnectionClient::connect);
|
Exception exception = catchException(testConnectionClient::connect);
|
||||||
|
|
||||||
|
@ -258,11 +261,14 @@ class LettuceSyncClientTest {
|
||||||
|
|
||||||
long serverPort = server.getMappedPort(6379);
|
long serverPort = server.getMappedPort(6379);
|
||||||
RedisClient client = RedisClient.create("redis://" + host + ":" + serverPort + "/" + DB_INDEX);
|
RedisClient client = RedisClient.create("redis://" + host + ":" + serverPort + "/" + DB_INDEX);
|
||||||
|
client.setOptions(CLIENT_OPTIONS);
|
||||||
StatefulRedisConnection<String, String> connection1 = client.connect();
|
StatefulRedisConnection<String, String> connection1 = client.connect();
|
||||||
cleanup.deferCleanup(connection1);
|
cleanup.deferCleanup(connection1);
|
||||||
|
cleanup.deferCleanup(client::shutdown);
|
||||||
|
|
||||||
RedisCommands<String, String> commands = connection1.sync();
|
RedisCommands<String, String> commands = connection1.sync();
|
||||||
// 1 connect trace
|
// 1 connect trace
|
||||||
|
testing.waitForTraces(1);
|
||||||
testing.clearData();
|
testing.clearData();
|
||||||
|
|
||||||
commands.debugSegfault();
|
commands.debugSegfault();
|
||||||
|
@ -289,11 +295,14 @@ class LettuceSyncClientTest {
|
||||||
|
|
||||||
RedisClient client =
|
RedisClient client =
|
||||||
RedisClient.create("redis://" + host + ":" + shutdownServerPort + "/" + DB_INDEX);
|
RedisClient.create("redis://" + host + ":" + shutdownServerPort + "/" + DB_INDEX);
|
||||||
|
client.setOptions(CLIENT_OPTIONS);
|
||||||
StatefulRedisConnection<String, String> connection1 = client.connect();
|
StatefulRedisConnection<String, String> connection1 = client.connect();
|
||||||
cleanup.deferCleanup(connection1);
|
cleanup.deferCleanup(connection1);
|
||||||
|
cleanup.deferCleanup(client::shutdown);
|
||||||
|
|
||||||
RedisCommands<String, String> commands = connection1.sync();
|
RedisCommands<String, String> commands = connection1.sync();
|
||||||
// 1 connect trace
|
// 1 connect trace
|
||||||
|
testing.waitForTraces(1);
|
||||||
testing.clearData();
|
testing.clearData();
|
||||||
|
|
||||||
commands.shutdown(false);
|
commands.shutdown(false);
|
||||||
|
|
Loading…
Reference in New Issue