1
0
mirror of https://github.com/redis/go-redis.git synced 2025-07-28 06:42:00 +03:00

Fix nil ptr in case when all nodes are unavailable.

This commit is contained in:
Vladimir Mihailenco
2016-12-12 17:30:08 +02:00
parent 7f2a0bff84
commit c7dfbb54af
3 changed files with 77 additions and 9 deletions

View File

@ -602,6 +602,33 @@ var _ = Describe("ClusterClient timeout", func() {
testTimeout()
})
Context("network timeout", func() {
const pause = time.Second
BeforeEach(func() {
opt := redisClusterOptions()
opt.ReadTimeout = 100 * time.Millisecond
opt.WriteTimeout = 100 * time.Millisecond
opt.MaxRedirects = 1
client = cluster.clusterClient(opt)
err := client.ForEachNode(func(client *redis.Client) error {
return client.ClientPause(pause).Err()
})
Expect(err).NotTo(HaveOccurred())
})
AfterEach(func() {
Eventually(func() error {
return client.ForEachNode(func(client *redis.Client) error {
return client.Ping().Err()
})
}, pause).ShouldNot(HaveOccurred())
})
testTimeout()
})
})
//------------------------------------------------------------------------------