Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework shutdown in lettuce 5.0 tests #12927

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension;
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -78,4 +79,16 @@ protected static StatefulRedisConnection<String, String> newContainerConnection(

return statefulConnection;
}

static void shutdown(RedisClient redisClient) {
// using shutdownAsync instead of redisClient.shutdown() because there is a bug in the redis
// client that can cause the shutdown to hang
try {
redisClient.shutdownAsync(0, 15, TimeUnit.SECONDS).get(15, TimeUnit.SECONDS);
} catch (InterruptedException exception) {
Thread.currentThread().interrupt();
} catch (Exception exception) {
// ignore
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ static void setUp() throws UnknownHostException {
@AfterAll
static void cleanUp() {
connection.close();
redisClient.shutdown();
shutdown(redisClient);
redisServer.stop();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void setUp() throws UnknownHostException {
@AfterAll
static void cleanUp() {
connection.close();
redisClient.shutdown();
shutdown(redisClient);
redisServer.stop();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static void setUp() throws UnknownHostException {
@AfterAll
static void cleanUp() {
connection.close();
redisClient.shutdown();
shutdown(redisClient);
redisServer.stop();
}

Expand Down
Loading