mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
Ensure context isn't exhausted via concurrent query as opposed to sentinel query (#3334)
This commit is contained in:
@ -3,6 +3,7 @@ package redis_test
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
. "github.com/bsm/ginkgo/v2"
|
||||
. "github.com/bsm/gomega"
|
||||
@ -32,6 +33,24 @@ var _ = Describe("Sentinel PROTO 2", func() {
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("Sentinel resolution", func() {
|
||||
It("should resolve master without context exhaustion", func() {
|
||||
shortCtx, cancel := context.WithTimeout(ctx, 500*time.Millisecond)
|
||||
defer cancel()
|
||||
|
||||
client := redis.NewFailoverClient(&redis.FailoverOptions{
|
||||
MasterName: sentinelName,
|
||||
SentinelAddrs: sentinelAddrs,
|
||||
MaxRetries: -1,
|
||||
})
|
||||
|
||||
err := client.Ping(shortCtx).Err()
|
||||
Expect(err).NotTo(HaveOccurred(), "expected master to resolve without context exhaustion")
|
||||
|
||||
_ = client.Close()
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("Sentinel", func() {
|
||||
var client *redis.Client
|
||||
var master *redis.Client
|
||||
|
Reference in New Issue
Block a user