@@ -6772,6 +6772,36 @@ var _ = Describe("Commands", func() {
67726772 }))
67736773 })
67746774
6775+ It ("should return -1 for nil lag in XINFO GROUPS" , func () {
6776+ _ , err := client .XAdd (ctx , & redis.XAddArgs {Stream : "s" , ID : "0-1" , Values : []string {"foo" , "1" }}).Result ()
6777+ Expect (err ).NotTo (HaveOccurred ())
6778+
6779+ client .XAdd (ctx , & redis.XAddArgs {Stream : "s" , ID : "0-2" , Values : []string {"foo" , "2" }})
6780+ Expect (err ).NotTo (HaveOccurred ())
6781+ client .XAdd (ctx , & redis.XAddArgs {Stream : "s" , ID : "0-3" , Values : []string {"foo" , "3" }})
6782+ Expect (err ).NotTo (HaveOccurred ())
6783+
6784+ err = client .XGroupCreate (ctx , "s" , "g" , "0" ).Err ()
6785+ Expect (err ).NotTo (HaveOccurred ())
6786+ err = client .XReadGroup (ctx , & redis.XReadGroupArgs {Group : "g" , Consumer : "c" , Streams : []string {"s" , ">" }, Count : 1 , Block : - 1 , NoAck : false }).Err ()
6787+ Expect (err ).NotTo (HaveOccurred ())
6788+
6789+ client .XDel (ctx , "s" , "0-2" )
6790+
6791+ res , err := client .XInfoGroups (ctx , "s" ).Result ()
6792+ Expect (err ).NotTo (HaveOccurred ())
6793+ Expect (res ).To (Equal ([]redis.XInfoGroup {
6794+ {
6795+ Name : "g" ,
6796+ Consumers : 1 ,
6797+ Pending : 1 ,
6798+ LastDeliveredID : "0-1" ,
6799+ EntriesRead : 1 ,
6800+ Lag : - 1 , // nil lag from Redis is reported as -1
6801+ },
6802+ }))
6803+ })
6804+
67756805 It ("should XINFO CONSUMERS" , func () {
67766806 res , err := client .XInfoConsumers (ctx , "stream" , "group1" ).Result ()
67776807 Expect (err ).NotTo (HaveOccurred ())
0 commit comments