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:
Christoph Strobl
2017-08-18 09:34:35 +02:00
committed by Mark Paluch
parent 17fc8fa7a0
commit 4e903113c7
3 changed files with 42 additions and 18 deletions

View File

@@ -32,11 +32,14 @@ import org.junit.Test;
import org.springframework.data.redis.ConnectionFactoryTracker;
import org.springframework.data.redis.connection.RedisClusterConfiguration;
import org.springframework.data.redis.connection.RedisSentinelConfiguration;
import org.springframework.test.util.ReflectionTestUtils;
import com.lambdaworks.redis.AbstractRedisClient;
import com.lambdaworks.redis.RedisClient;
import com.lambdaworks.redis.RedisURI;
import com.lambdaworks.redis.cluster.RedisClusterClient;
import org.springframework.test.util.ReflectionTestUtils;
/**
* @author Christoph Strobl
@@ -275,4 +278,14 @@ public class LettuceConnectionFactoryUnitTests {
assertThat(uri.isVerifyPeer(), is(true));
}
}
@Test // DATAREDIS-676
public void timeoutShouldBePassedOnToClusterConnection() {
LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(clusterConfig);
connectionFactory.setTimeout(2000);
connectionFactory.afterPropertiesSet();
assertThat((Long) ReflectionTestUtils.getField(connectionFactory.getClusterConnection(), "timeout"), is(equalTo(2000L)));
}
}