1
0
mirror of https://github.com/redis/go-redis.git synced 2025-06-12 14:21:52 +03:00

Add support to get cluster replica node for a given key

This commit is contained in:
Prathik Rajendran M
2020-12-16 16:55:40 +05:30
parent 80d296154f
commit fd6643daa1
2 changed files with 43 additions and 0 deletions

View File

@ -864,6 +864,20 @@ var _ = Describe("ClusterClient", func() {
}))
})
It("should return correct replica for key", func() {
client, err := client.ReplicaForKey(ctx, "test")
Expect(err).ToNot(HaveOccurred())
info := client.Info(ctx, "server")
Expect(info.Val()).Should(ContainSubstring("tcp_port:8224"))
})
It("should return correct master for key", func() {
client, err := client.MasterForKey(ctx, "test")
Expect(err).ToNot(HaveOccurred())
info := client.Info(ctx, "server")
Expect(info.Val()).Should(ContainSubstring("tcp_port:8221"))
})
assertClusterClient()
})