mirror of https://github.com/go-redis/redis.git
test: redis-version to 7.2-rc1 (#2532)
* test: redis-version to 7.2-rc1 Signed-off-by: monkey92t <golang@88.com>
This commit is contained in:
parent
a42ba14851
commit
6edb1529ff
|
@ -20,7 +20,7 @@ jobs:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis:7.2-rc
|
||||||
options: >-
|
options: >-
|
||||||
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
|
||||||
ports:
|
ports:
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -23,7 +23,7 @@ bench: testdeps
|
||||||
|
|
||||||
testdata/redis:
|
testdata/redis:
|
||||||
mkdir -p $@
|
mkdir -p $@
|
||||||
wget -qO- https://download.redis.io/releases/redis-7.0.10.tar.gz | tar xvz --strip-components=1 -C $@
|
wget -qO- https://download.redis.io/releases/redis-7.2-rc1.tar.gz | tar xvz --strip-components=1 -C $@
|
||||||
|
|
||||||
testdata/redis/src/redis-server: testdata/redis
|
testdata/redis/src/redis-server: testdata/redis
|
||||||
cd $< && make all
|
cd $< && make all
|
||||||
|
|
38
command.go
38
command.go
|
@ -1892,9 +1892,10 @@ type XInfoConsumersCmd struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type XInfoConsumer struct {
|
type XInfoConsumer struct {
|
||||||
Name string
|
Name string
|
||||||
Pending int64
|
Pending int64
|
||||||
Idle time.Duration
|
Idle time.Duration
|
||||||
|
Inactive time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ Cmder = (*XInfoConsumersCmd)(nil)
|
var _ Cmder = (*XInfoConsumersCmd)(nil)
|
||||||
|
@ -1932,12 +1933,13 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
|
||||||
cmd.val = make([]XInfoConsumer, n)
|
cmd.val = make([]XInfoConsumer, n)
|
||||||
|
|
||||||
for i := 0; i < len(cmd.val); i++ {
|
for i := 0; i < len(cmd.val); i++ {
|
||||||
if err = rd.ReadFixedMapLen(3); err != nil {
|
nn, err := rd.ReadMapLen()
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var key string
|
var key string
|
||||||
for f := 0; f < 3; f++ {
|
for f := 0; f < nn; f++ {
|
||||||
key, err = rd.ReadString()
|
key, err = rd.ReadString()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -1952,6 +1954,10 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
|
||||||
var idle int64
|
var idle int64
|
||||||
idle, err = rd.ReadInt()
|
idle, err = rd.ReadInt()
|
||||||
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
|
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
|
||||||
|
case "inactive":
|
||||||
|
var inactive int64
|
||||||
|
inactive, err = rd.ReadInt()
|
||||||
|
cmd.val[i].Inactive = time.Duration(inactive) * 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)
|
||||||
}
|
}
|
||||||
|
@ -2226,10 +2232,11 @@ type XInfoStreamGroupPending struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type XInfoStreamConsumer struct {
|
type XInfoStreamConsumer struct {
|
||||||
Name string
|
Name string
|
||||||
SeenTime time.Time
|
SeenTime time.Time
|
||||||
PelCount int64
|
ActiveTime time.Time
|
||||||
Pending []XInfoStreamConsumerPending
|
PelCount int64
|
||||||
|
Pending []XInfoStreamConsumerPending
|
||||||
}
|
}
|
||||||
|
|
||||||
type XInfoStreamConsumerPending struct {
|
type XInfoStreamConsumerPending struct {
|
||||||
|
@ -2452,13 +2459,14 @@ func readXInfoStreamConsumers(rd *proto.Reader) ([]XInfoStreamConsumer, error) {
|
||||||
consumers := make([]XInfoStreamConsumer, 0, n)
|
consumers := make([]XInfoStreamConsumer, 0, n)
|
||||||
|
|
||||||
for i := 0; i < n; i++ {
|
for i := 0; i < n; i++ {
|
||||||
if err = rd.ReadFixedMapLen(4); err != nil {
|
nn, err := rd.ReadMapLen()
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
c := XInfoStreamConsumer{}
|
c := XInfoStreamConsumer{}
|
||||||
|
|
||||||
for f := 0; f < 4; f++ {
|
for f := 0; f < nn; f++ {
|
||||||
cKey, err := rd.ReadString()
|
cKey, err := rd.ReadString()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -2472,7 +2480,13 @@ func readXInfoStreamConsumers(rd *proto.Reader) ([]XInfoStreamConsumer, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
c.SeenTime = time.Unix(seen/1000, seen%1000*int64(time.Millisecond))
|
c.SeenTime = time.UnixMilli(seen)
|
||||||
|
case "active-time":
|
||||||
|
active, err := rd.ReadInt()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
c.ActiveTime = time.UnixMilli(active)
|
||||||
case "pel-count":
|
case "pel-count":
|
||||||
c.PelCount, err = rd.ReadInt()
|
c.PelCount, err = rd.ReadInt()
|
||||||
case "pending":
|
case "pending":
|
||||||
|
|
|
@ -5749,7 +5749,9 @@ var _ = Describe("Commands", func() {
|
||||||
}
|
}
|
||||||
for k3, c := range g.Consumers {
|
for k3, c := range g.Consumers {
|
||||||
Expect(now.Sub(c.SeenTime)).To(BeNumerically("<=", maxElapsed))
|
Expect(now.Sub(c.SeenTime)).To(BeNumerically("<=", maxElapsed))
|
||||||
|
Expect(now.Sub(c.ActiveTime)).To(BeNumerically("<=", maxElapsed))
|
||||||
res.Groups[k].Consumers[k3].SeenTime = time.Time{}
|
res.Groups[k].Consumers[k3].SeenTime = time.Time{}
|
||||||
|
res.Groups[k].Consumers[k3].ActiveTime = time.Time{}
|
||||||
|
|
||||||
for k4, p := range c.Pending {
|
for k4, p := range c.Pending {
|
||||||
Expect(now.Sub(p.DeliveryTime)).To(BeNumerically("<=", maxElapsed))
|
Expect(now.Sub(p.DeliveryTime)).To(BeNumerically("<=", maxElapsed))
|
||||||
|
@ -5773,10 +5775,12 @@ var _ = Describe("Commands", func() {
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
for i := range res {
|
for i := range res {
|
||||||
res[i].Idle = 0
|
res[i].Idle = 0
|
||||||
|
res[i].Inactive = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Expect(res).To(Equal([]redis.XInfoConsumer{
|
Expect(res).To(Equal([]redis.XInfoConsumer{
|
||||||
{Name: "consumer1", Pending: 2, Idle: 0},
|
{Name: "consumer1", Pending: 2, Idle: 0, Inactive: 0},
|
||||||
{Name: "consumer2", Pending: 1, Idle: 0},
|
{Name: "consumer2", Pending: 1, Idle: 0, Inactive: 0},
|
||||||
}))
|
}))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue