mirror of https://github.com/go-redis/redis.git
fix: add XInfoConsumers test
Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
parent
997ab5e7e3
commit
6f1a1ac284
|
@ -1906,21 +1906,21 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var idle int64
|
|
||||||
switch key {
|
switch key {
|
||||||
case "name":
|
case "name":
|
||||||
cmd.val[i].Name, err = rd.ReadString()
|
cmd.val[i].Name, err = rd.ReadString()
|
||||||
case "pending":
|
case "pending":
|
||||||
cmd.val[i].Pending, err = rd.ReadInt()
|
cmd.val[i].Pending, err = rd.ReadInt()
|
||||||
case "idle":
|
case "idle":
|
||||||
|
var idle int64
|
||||||
idle, err = rd.ReadInt()
|
idle, err = rd.ReadInt()
|
||||||
|
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key)
|
return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5008,6 +5008,7 @@ var _ = Describe("Commands", func() {
|
||||||
res, err := client.XInfoConsumers(ctx, "stream", "group1").Result()
|
res, err := client.XInfoConsumers(ctx, "stream", "group1").Result()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
for i := range res {
|
for i := range res {
|
||||||
|
Expect(res[i].Idle > 0).To(BeTrue())
|
||||||
res[i].Idle = 0
|
res[i].Idle = 0
|
||||||
}
|
}
|
||||||
Expect(res).To(Equal([]redis.XInfoConsumer{
|
Expect(res).To(Equal([]redis.XInfoConsumer{
|
||||||
|
|
Loading…
Reference in New Issue