Skip to content

Commit d231fa0

Browse files
authored
Add test for proper sentinel resolution
1 parent 84b2016 commit d231fa0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

sentinel_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,24 @@ var _ = Describe("Sentinel PROTO 2", func() {
3232
})
3333
})
3434

35+
var _ = Describe("Sentinel resolution", func() {
36+
It("should resolve master without context exhaustion", func() {
37+
shortCtx, cancel := context.WithTimeout(ctx, 500*time.Millisecond)
38+
defer cancel()
39+
40+
client := redis.NewFailoverClient(&redis.FailoverOptions{
41+
MasterName: sentinelName,
42+
SentinelAddrs: sentinelAddrs,
43+
MaxRetries: -1,
44+
})
45+
46+
err := client.Ping(shortCtx).Err()
47+
Expect(err).NotTo(HaveOccurred(), "expected master to resolve without context exhaustion")
48+
49+
_ = client.Close()
50+
})
51+
})
52+
3553
var _ = Describe("Sentinel", func() {
3654
var client *redis.Client
3755
var master *redis.Client

0 commit comments

Comments
 (0)