Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added oryxBuildBinary
Binary file not shown.
2 changes: 2 additions & 0 deletions universal.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ func (o *UniversalOptions) Failover() *FailoverOptions {

TLSConfig: o.TLSConfig,

ReplicaOnly: o.ReadOnly,

DisableIndentity: o.DisableIndentity,
IdentitySuffix: o.IdentitySuffix,
UnstableResp3: o.UnstableResp3,
Expand Down
28 changes: 28 additions & 0 deletions universal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,32 @@ var _ = Describe("UniversalClient", func() {
a := func() { client.FTInfo(ctx, "all").Result() }
Expect(a).ToNot(Panic())
})


It("should connect to failover servers on slaves when readonly Options is ok", func() {
Skip("Flaky Test")
client = redis.NewUniversalClient(&redis.UniversalOptions{
MasterName: sentinelName,
Addrs: sentinelAddrs,
ReadOnly: true,
})
Expect(client.Ping(ctx).Err()).NotTo(HaveOccurred())


roleCmd := client.Do(ctx, "ROLE")
role, err := roleCmd.Result()
Expect(err).NotTo(HaveOccurred())

roleSlice, ok := role.([]interface{})
Expect(ok).To(BeTrue())
Expect(roleSlice[0]).To(Equal("slave"))


err = client.Set(ctx, "somekey", "somevalue", 0).Err()
Expect(err).To(HaveOccurred())

})


})

Loading