@@ -1988,22 +1988,38 @@ var _ = Describe("Commands", func() {
1988
1988
1989
1989
It ("should ACL LOG" , func () {
1990
1990
1991
+ err := client .Do (ctx , "acl" , "setuser" , "test" , ">test" , "on" , "allkeys" , "+get" ).Err ()
1992
+ Expect (err ).NotTo (HaveOccurred ())
1993
+
1994
+ clientAcl := redis .NewClient (redisOptions ())
1995
+ clientAcl .Options ().Username = "test"
1996
+ clientAcl .Options ().Password = "test"
1997
+ clientAcl .Options ().DB = 0
1998
+ _ = clientAcl .Set (ctx , "mystring" , "foo" , 0 ).Err ()
1999
+ _ = clientAcl .HSet (ctx , "myhash" , "foo" , "bar" ).Err ()
2000
+ _ = clientAcl .SAdd (ctx , "myset" , "foo" , "bar" ).Err ()
2001
+
1991
2002
logEntries , err := client .ACLLog (ctx , 10 ).Result ()
1992
2003
Expect (err ).NotTo (HaveOccurred ())
1993
- Expect (logEntries ). NotTo ( BeNil ( ))
2004
+ Expect (len ( logEntries )). To ( Equal ( 3 ))
1994
2005
1995
2006
for _ , entry := range logEntries {
1996
- Expect (entry .Count ).To (BeNumerically (">= " , 0 ))
1997
- Expect (entry .Reason ).NotTo ( BeEmpty ( ))
1998
- Expect (entry .Context ).NotTo ( BeEmpty ( ))
2007
+ Expect (entry .Count ).To (BeNumerically ("== " , 1 ))
2008
+ Expect (entry .Reason ).To ( Equal ( "command" ))
2009
+ Expect (entry .Context ).To ( Equal ( "toplevel" ))
1999
2010
Expect (entry .Object ).NotTo (BeEmpty ())
2000
- Expect (entry .Username ).NotTo ( BeEmpty ( ))
2011
+ Expect (entry .Username ).To ( Equal ( "test" ))
2001
2012
Expect (entry .AgeSeconds ).To (BeNumerically (">=" , 0 ))
2002
2013
Expect (entry .ClientInfo ).NotTo (BeNil ())
2003
2014
Expect (entry .EntryID ).To (BeNumerically (">=" , 0 ))
2004
2015
Expect (entry .TimestampCreated ).To (BeNumerically (">=" , 0 ))
2005
2016
Expect (entry .TimestampLastUpdated ).To (BeNumerically (">=" , 0 ))
2006
2017
}
2018
+
2019
+ limitedLogEntries , err := client .ACLLog (ctx , 2 ).Result ()
2020
+ Expect (err ).NotTo (HaveOccurred ())
2021
+ Expect (len (limitedLogEntries )).To (Equal (2 ))
2022
+
2007
2023
})
2008
2024
2009
2025
It ("should ACL LOG RESET" , func () {
0 commit comments