Optimize Redis integration tests
This commit ensures that Redis Testcontainers used for integration testing are managed by Spring to ensure proper ordering on shutdown. Previously, Redis Testcontainer was closed before LettuceConnectionFactory which caused pending commands to hang and added a lot of wait to project build. Closes gh-1086
This commit is contained in:
@@ -28,11 +28,14 @@ import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactor
|
||||
@Profile("embedded-redis")
|
||||
public class EmbeddedRedisConfig {
|
||||
|
||||
private static final String REDIS_DOCKER_IMAGE = "redis:4.0.9";
|
||||
private static final String DOCKER_IMAGE = "redis:4.0.9";
|
||||
|
||||
@Bean(initMethod = "start")
|
||||
@Bean
|
||||
public GenericContainer redisContainer() {
|
||||
return new GenericContainer(REDIS_DOCKER_IMAGE).withExposedPorts(6379);
|
||||
GenericContainer redisContainer = new GenericContainer(DOCKER_IMAGE)
|
||||
.withExposedPorts(6379);
|
||||
redisContainer.start();
|
||||
return redisContainer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
Reference in New Issue
Block a user