@@ -57,4 +57,54 @@ var _ = Describe("ACL Commands", func() {
57
57
Expect (resAfterDeletion ).To (HaveLen (1 ))
58
58
Expect (resAfterDeletion [0 ]).To (BeEquivalentTo (res [0 ]))
59
59
})
60
+
61
+ It ("lists acl categories and subcategories" , func () {
62
+ res , err := client .ACLCat (ctx ).Result ()
63
+ Expect (err ).NotTo (HaveOccurred ())
64
+ Expect (len (res )).To (BeNumerically (">" , 20 ))
65
+ Expect (res ).To (ContainElements (
66
+ "read" ,
67
+ "write" ,
68
+ "keyspace" ,
69
+ "dangerous" ,
70
+ "slow" ,
71
+ "set" ,
72
+ "sortedset" ,
73
+ "list" ,
74
+ "hash" ,
75
+ ))
76
+
77
+ res , err = client .ACLCatArgs (ctx , & redis.ACLCatArgs {Category : "read" }).Result ()
78
+ Expect (err ).NotTo (HaveOccurred ())
79
+ Expect (res ).To (ContainElement ("get" ))
80
+ })
81
+
82
+ It ("lists acl categories and subcategories with Modules" , func () {
83
+ SkipBeforeRedisMajor (8 , "modules are included in acl for redis version >= 8" )
84
+ aclTestCase := map [string ]string {
85
+ "search" : "FT.CREATE" ,
86
+ "bloom" : "bf.add" ,
87
+ "json" : "json.get" ,
88
+ "cuckoo" : "cf.insert" ,
89
+ "cms" : "cms.query" ,
90
+ "topk" : "topk.list" ,
91
+ "tdigest" : "tdigest.rank" ,
92
+ "timeseries" : "ts.range" ,
93
+ }
94
+ var cats []interface {}
95
+
96
+ for cat , subitem := range aclTestCase {
97
+ cats = append (cats , cat )
98
+
99
+ res , err := client .ACLCatArgs (ctx , & redis.ACLCatArgs {
100
+ Category : cat ,
101
+ }).Result ()
102
+ Expect (err ).NotTo (HaveOccurred ())
103
+ Expect (res ).To (ContainElement (subitem ))
104
+ }
105
+
106
+ res , err := client .ACLCat (ctx ).Result ()
107
+ Expect (err ).NotTo (HaveOccurred ())
108
+ Expect (res ).To (ContainElements (cats ... ))
109
+ })
60
110
})
0 commit comments