Fix tests

This commit is contained in:
Vladimir Mihailenco 2018-11-21 11:09:21 +02:00
parent 18e7a81047
commit 4d5a8b91ad
3 changed files with 12 additions and 2 deletions

View File

@ -3,6 +3,8 @@ all: testdeps
go test ./... -short -race
env GOOS=linux GOARCH=386 go test ./...
go vet
go get github.com/gordonklaus/ineffassign
ineffassign .
testdeps: testdata/redis/src/redis-server

View File

@ -1447,6 +1447,7 @@ type XReadGroupArgs struct {
Streams []string
Count int64
Block time.Duration
NoAck bool
}
func (c *cmdable) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd {
@ -1458,6 +1459,9 @@ func (c *cmdable) XReadGroup(a *XReadGroupArgs) *XStreamSliceCmd {
if a.Block >= 0 {
args = append(args, "block", int64(a.Block/time.Millisecond))
}
if a.NoAck {
args = append(args, "noack")
}
args = append(args, "streams")
for _, s := range a.Streams {
args = append(args, s)

View File

@ -69,7 +69,7 @@ var _ = Describe("Commands", func() {
val, err := client.Wait(1, wait).Result()
Expect(err).NotTo(HaveOccurred())
Expect(val).To(Equal(int64(0)))
Expect(time.Now()).To(BeTemporally("~", start.Add(wait), time.Second))
Expect(time.Now()).To(BeTemporally("~", start.Add(wait), 3*time.Second))
})
It("should Select", func() {
@ -2793,10 +2793,13 @@ var _ = Describe("Commands", func() {
Member: "one",
}).Err()
Expect(err).NotTo(HaveOccurred())
err = client.ZAdd("zset", redis.Z{
Score: 2,
Member: "two",
}).Err()
Expect(err).NotTo(HaveOccurred())
members, err = client.ZPopMin("zset", 10).Result()
Expect(err).NotTo(HaveOccurred())
Expect(members).To(Equal([]redis.Z{{
@ -3541,8 +3544,9 @@ var _ = Describe("Commands", func() {
res, err := client.XReadGroup(&redis.XReadGroupArgs{
Group: "group",
Consumer: "consumer",
Streams: []string{"stream", "0"},
Streams: []string{"stream", ">"},
}).Result()
Expect(err).NotTo(HaveOccurred())
Expect(res).To(Equal([]redis.XStream{{
Stream: "stream",
Messages: []redis.XMessage{