DATAREDIS-676 - Pass on configured command timeout to LettuceClusterConnection.
We now not only configure the underlying lettuce connection with the command timeout set via the connection factory, but also make sure to pass the option on to the LettuceClusterConnection. Original pull request: #266.
This commit is contained in:
committed by
Mark Paluch
parent
65d320b3c8
commit
7c20dd2f83
@@ -43,6 +43,7 @@ import org.springframework.data.redis.connection.RedisClusterConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisPassword;
|
||||
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
|
||||
import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
|
||||
import org.springframework.test.util.ReflectionTestUtils;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link LettuceConnectionFactory}.
|
||||
@@ -486,4 +487,23 @@ public class LettuceConnectionFactoryUnitTests {
|
||||
|
||||
connectionFactory.setUseSsl(false);
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-676
|
||||
public void timeoutShouldBePassedOnToClusterConnection() {
|
||||
|
||||
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(clusterConfig);
|
||||
connectionFactory.setTimeout(2000);
|
||||
connectionFactory.afterPropertiesSet();
|
||||
|
||||
assertThat(ReflectionTestUtils.getField(connectionFactory.getClusterConnection(), "timeout"), is(equalTo(2000L)));
|
||||
}
|
||||
|
||||
@Test // DATAREDIS-676
|
||||
public void timeoutSetOnClientConfigShouldBePassedOnToClusterConnection() {
|
||||
|
||||
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(clusterConfig, LettuceClientConfiguration.builder().commandTimeout(Duration.ofSeconds(2)).build());
|
||||
connectionFactory.afterPropertiesSet();
|
||||
|
||||
assertThat(ReflectionTestUtils.getField(connectionFactory.getClusterConnection(), "timeout"), is(equalTo(2000L)));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user