Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 6 additions & 1 deletion acl_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ func (c cmdable) ACLSetUser(ctx context.Context, username string, rules ...strin
}

func (c cmdable) ACLGenPass(ctx context.Context, bit int) *StringCmd {
cmd := NewStringCmd(ctx, "acl", "genpass")
args := make([]interface{}, 0, 3)
args = append(args, "acl", "genpass")
if bit > 0 {
args = append(args, bit)
}
cmd := NewStringCmd(ctx, args...)
_ = c(ctx, cmd)
return cmd
}
Expand Down
8 changes: 8 additions & 0 deletions acl_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ var _ = Describe("ACL user commands", Label("NonRedisEnterprise"), func() {
Expect(password).NotTo(BeEmpty())
})

It("gen password with length", func() {
bit := 128
password, err := client.ACLGenPass(ctx, bit).Result()
Expect(err).NotTo(HaveOccurred())
Expect(password).NotTo(BeEmpty())
Expect(len(password)).To(Equal(bit / 4))
})

It("setuser and deluser", func() {
res, err := client.ACLList(ctx).Result()
Expect(err).NotTo(HaveOccurred())
Expand Down
Loading