mirror of
https://github.com/redis/go-redis.git
synced 2025-07-31 05:04:23 +03:00
Use DB option in NewFailoverClusterClient (#3342)
This commit is contained in:
@ -200,6 +200,7 @@ var _ = Describe("NewFailoverClusterClient", func() {
|
||||
SentinelAddrs: sentinelAddrs,
|
||||
|
||||
RouteRandomly: true,
|
||||
DB: 1,
|
||||
})
|
||||
Expect(client.FlushDB(ctx).Err()).NotTo(HaveOccurred())
|
||||
|
||||
@ -289,6 +290,20 @@ var _ = Describe("NewFailoverClusterClient", func() {
|
||||
})
|
||||
})
|
||||
|
||||
It("should sentinel cluster client db", func() {
|
||||
err := client.ForEachShard(ctx, func(ctx context.Context, c *redis.Client) error {
|
||||
return c.Ping(ctx).Err()
|
||||
})
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
|
||||
_ = client.ForEachShard(ctx, func(ctx context.Context, c *redis.Client) error {
|
||||
clientInfo, err := c.ClientInfo(ctx).Result()
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(clientInfo.DB).To(Equal(1))
|
||||
return nil
|
||||
})
|
||||
})
|
||||
|
||||
It("should sentinel cluster PROTO 3", func() {
|
||||
_ = client.ForEachShard(ctx, func(ctx context.Context, c *redis.Client) error {
|
||||
val, err := client.Do(ctx, "HELLO").Result()
|
||||
|
Reference in New Issue
Block a user