diff --git a/commands_test.go b/commands_test.go index d30a9d8bb..5af2797eb 100644 --- a/commands_test.go +++ b/commands_test.go @@ -2105,7 +2105,7 @@ var _ = Describe("Commands", func() { logEntries, err := client.ACLLog(ctx, 10).Result() Expect(err).NotTo(HaveOccurred()) - Expect(len(logEntries)).To(Equal(4)) + Expect(len(logEntries)).To(Equal(1)) for _, entry := range logEntries { Expect(entry.Reason).To(Equal("command")) @@ -2121,7 +2121,7 @@ var _ = Describe("Commands", func() { limitedLogEntries, err := client.ACLLog(ctx, 2).Result() Expect(err).NotTo(HaveOccurred()) - Expect(len(limitedLogEntries)).To(Equal(2)) + Expect(len(limitedLogEntries)).To(Equal(1)) }) It("should ACL LOG RESET", Label("NonRedisEnterprise"), func() { diff --git a/redis.go b/redis.go index c8f513119..33477b53a 100644 --- a/redis.go +++ b/redis.go @@ -312,16 +312,7 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error { // difficult to rely on error strings to determine all results. return err } - if !c.opt.DisableIndentity { - libName := "" - libVer := Version() - if c.opt.IdentitySuffix != "" { - libName = c.opt.IdentitySuffix - } - conn.ClientSetInfo(ctx, WithLibraryName(libName)) - conn.ClientSetInfo(ctx, WithLibraryVersion(libVer)) - } _, err := conn.Pipelined(ctx, func(pipe Pipeliner) error { if !auth && password != "" { if username != "" { @@ -343,6 +334,16 @@ func (c *baseClient) initConn(ctx context.Context, cn *pool.Conn) error { pipe.ClientSetName(ctx, c.opt.ClientName) } + if !c.opt.DisableIndentity { + libName := "" + libVer := Version() + if c.opt.IdentitySuffix != "" { + libName = c.opt.IdentitySuffix + } + pipe.ClientSetInfo(ctx, WithLibraryName(libName)) + pipe.ClientSetInfo(ctx, WithLibraryVersion(libVer)) + } + return nil }) if err != nil { diff --git a/sentinel_test.go b/sentinel_test.go index 4c013f05f..8bc6c5785 100644 --- a/sentinel_test.go +++ b/sentinel_test.go @@ -324,7 +324,7 @@ var _ = Describe("SentinelAclAuth", func() { BeforeEach(func() { authCmd := redis.NewStatusCmd(ctx, "ACL", "SETUSER", aclSentinelUsername, "ON", ">"+aclSentinelPassword, "-@all", "+auth", "+client|getname", "+client|id", "+client|setname", - "+command", "+hello", "+ping", "+role", "+sentinel|get-master-addr-by-name", "+sentinel|master", + "+command", "+hello", "+ping", "+client|setinfo", "+role", "+sentinel|get-master-addr-by-name", "+sentinel|master", "+sentinel|myid", "+sentinel|replicas", "+sentinel|sentinels") for _, process := range sentinels() {