Skip to content

Commit 6edb152

Browse files
authored
test: redis-version to 7.2-rc1 (#2532)
* test: redis-version to 7.2-rc1 Signed-off-by: monkey92t <[email protected]>
1 parent a42ba14 commit 6edb152

File tree

4 files changed

+34
-16
lines changed

4 files changed

+34
-16
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
services:
2222
redis:
23-
image: redis
23+
image: redis:7.2-rc
2424
options: >-
2525
--health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
2626
ports:

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ bench: testdeps
2323

2424
testdata/redis:
2525
mkdir -p $@
26-
wget -qO- https://download.redis.io/releases/redis-7.0.10.tar.gz | tar xvz --strip-components=1 -C $@
26+
wget -qO- https://download.redis.io/releases/redis-7.2-rc1.tar.gz | tar xvz --strip-components=1 -C $@
2727

2828
testdata/redis/src/redis-server: testdata/redis
2929
cd $< && make all

command.go

+26-12
Original file line numberDiff line numberDiff line change
@@ -1892,9 +1892,10 @@ type XInfoConsumersCmd struct {
18921892
}
18931893

18941894
type XInfoConsumer struct {
1895-
Name string
1896-
Pending int64
1897-
Idle time.Duration
1895+
Name string
1896+
Pending int64
1897+
Idle time.Duration
1898+
Inactive time.Duration
18981899
}
18991900

19001901
var _ Cmder = (*XInfoConsumersCmd)(nil)
@@ -1932,12 +1933,13 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
19321933
cmd.val = make([]XInfoConsumer, n)
19331934

19341935
for i := 0; i < len(cmd.val); i++ {
1935-
if err = rd.ReadFixedMapLen(3); err != nil {
1936+
nn, err := rd.ReadMapLen()
1937+
if err != nil {
19361938
return err
19371939
}
19381940

19391941
var key string
1940-
for f := 0; f < 3; f++ {
1942+
for f := 0; f < nn; f++ {
19411943
key, err = rd.ReadString()
19421944
if err != nil {
19431945
return err
@@ -1952,6 +1954,10 @@ func (cmd *XInfoConsumersCmd) readReply(rd *proto.Reader) error {
19521954
var idle int64
19531955
idle, err = rd.ReadInt()
19541956
cmd.val[i].Idle = time.Duration(idle) * time.Millisecond
1957+
case "inactive":
1958+
var inactive int64
1959+
inactive, err = rd.ReadInt()
1960+
cmd.val[i].Inactive = time.Duration(inactive) * time.Millisecond
19551961
default:
19561962
return fmt.Errorf("redis: unexpected content %s in XINFO CONSUMERS reply", key)
19571963
}
@@ -2226,10 +2232,11 @@ type XInfoStreamGroupPending struct {
22262232
}
22272233

22282234
type XInfoStreamConsumer struct {
2229-
Name string
2230-
SeenTime time.Time
2231-
PelCount int64
2232-
Pending []XInfoStreamConsumerPending
2235+
Name string
2236+
SeenTime time.Time
2237+
ActiveTime time.Time
2238+
PelCount int64
2239+
Pending []XInfoStreamConsumerPending
22332240
}
22342241

22352242
type XInfoStreamConsumerPending struct {
@@ -2452,13 +2459,14 @@ func readXInfoStreamConsumers(rd *proto.Reader) ([]XInfoStreamConsumer, error) {
24522459
consumers := make([]XInfoStreamConsumer, 0, n)
24532460

24542461
for i := 0; i < n; i++ {
2455-
if err = rd.ReadFixedMapLen(4); err != nil {
2462+
nn, err := rd.ReadMapLen()
2463+
if err != nil {
24562464
return nil, err
24572465
}
24582466

24592467
c := XInfoStreamConsumer{}
24602468

2461-
for f := 0; f < 4; f++ {
2469+
for f := 0; f < nn; f++ {
24622470
cKey, err := rd.ReadString()
24632471
if err != nil {
24642472
return nil, err
@@ -2472,7 +2480,13 @@ func readXInfoStreamConsumers(rd *proto.Reader) ([]XInfoStreamConsumer, error) {
24722480
if err != nil {
24732481
return nil, err
24742482
}
2475-
c.SeenTime = time.Unix(seen/1000, seen%1000*int64(time.Millisecond))
2483+
c.SeenTime = time.UnixMilli(seen)
2484+
case "active-time":
2485+
active, err := rd.ReadInt()
2486+
if err != nil {
2487+
return nil, err
2488+
}
2489+
c.ActiveTime = time.UnixMilli(active)
24762490
case "pel-count":
24772491
c.PelCount, err = rd.ReadInt()
24782492
case "pending":

commands_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -5749,7 +5749,9 @@ var _ = Describe("Commands", func() {
57495749
}
57505750
for k3, c := range g.Consumers {
57515751
Expect(now.Sub(c.SeenTime)).To(BeNumerically("<=", maxElapsed))
5752+
Expect(now.Sub(c.ActiveTime)).To(BeNumerically("<=", maxElapsed))
57525753
res.Groups[k].Consumers[k3].SeenTime = time.Time{}
5754+
res.Groups[k].Consumers[k3].ActiveTime = time.Time{}
57535755

57545756
for k4, p := range c.Pending {
57555757
Expect(now.Sub(p.DeliveryTime)).To(BeNumerically("<=", maxElapsed))
@@ -5773,10 +5775,12 @@ var _ = Describe("Commands", func() {
57735775
Expect(err).NotTo(HaveOccurred())
57745776
for i := range res {
57755777
res[i].Idle = 0
5778+
res[i].Inactive = 0
57765779
}
5780+
57775781
Expect(res).To(Equal([]redis.XInfoConsumer{
5778-
{Name: "consumer1", Pending: 2, Idle: 0},
5779-
{Name: "consumer2", Pending: 1, Idle: 0},
5782+
{Name: "consumer1", Pending: 2, Idle: 0, Inactive: 0},
5783+
{Name: "consumer2", Pending: 1, Idle: 0, Inactive: 0},
57805784
}))
57815785
})
57825786
})

0 commit comments

Comments
 (0)