feat: redis 支持超时
This commit is contained in:
@@ -32,3 +32,18 @@ func TestAddClientKeepsMasterAndSlaveSeparate(t *testing.T) {
|
||||
_ = info.MasterClient().Close()
|
||||
_ = info.SlaveClient().Close()
|
||||
}
|
||||
|
||||
func TestNewClientPassesContextTimeoutEnabled(t *testing.T) {
|
||||
client := &OwnClient{}
|
||||
redisClient := client.newClient(&define.Options{
|
||||
Addr: "127.0.0.1:6379",
|
||||
ContextTimeoutEnabled: true,
|
||||
})
|
||||
t.Cleanup(func() {
|
||||
_ = redisClient.Close()
|
||||
})
|
||||
|
||||
if !redisClient.Options().ContextTimeoutEnabled {
|
||||
t.Fatal("context timeout option was not passed to go-redis")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user