1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-29 17:41:15 +03:00

Add Dialer option.

This commit is contained in:
Vladimir Mihailenco
2014-09-30 11:46:56 +03:00
parent 593d5d1d77
commit 2508d0a57e
2 changed files with 31 additions and 6 deletions

View File

@ -69,6 +69,18 @@ func (t *RedisConnectorTest) TestNewUnixClient(c *C) {
c.Assert(client.Close(), IsNil)
}
func (t *RedisConnectorTest) TestDialer(c *C) {
client := redis.NewClient(&redis.Options{
Dialer: func() (net.Conn, error) {
return net.Dial("tcp", redisAddr)
},
})
ping := client.Ping()
c.Check(ping.Err(), IsNil)
c.Check(ping.Val(), Equals, "PONG")
c.Assert(client.Close(), IsNil)
}
func (t *RedisConnectorTest) TestClose(c *C) {
client := redis.NewTCPClient(&redis.Options{
Addr: redisAddr,