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

Add support for individual passwords for ring shards

This commit is contained in:
Michael Benford
2019-07-09 16:00:10 -03:00
parent 850dea52a1
commit 9169633580
2 changed files with 37 additions and 3 deletions

View File

@ -172,6 +172,29 @@ var _ = Describe("Redis Ring", func() {
Expect(ringShard2.Info().Val()).To(ContainSubstring("keys=100"))
})
})
Describe("shard passwords", func() {
It("can be initialized with a single password, used for all shards", func() {
opts := redisRingOptions()
opts.Password = "password"
ring = redis.NewRing(opts)
err := ring.Ping().Err()
Expect(err).To(MatchError("ERR Client sent AUTH, but no password is set"))
})
It("can be initialized with a passwords map, one for each shard", func() {
opts := redisRingOptions()
opts.Passwords = map[string]string{
"ringShardOne": "password1",
"ringShardTwo": "password2",
}
ring = redis.NewRing(opts)
err := ring.Ping().Err()
Expect(err).To(MatchError("ERR Client sent AUTH, but no password is set"))
})
})
})
var _ = Describe("empty Redis Ring", func() {