mirror of
https://github.com/redis/go-redis.git
synced 2025-10-20 09:52:25 +03:00
Added batch process method to the pipeline (#3510)
* Added batch process method to the pipeline * Added Process and BatchProcess tests * Fix test matching
This commit is contained in:
@@ -114,6 +114,25 @@ var _ = Describe("pipelining", func() {
|
||||
err := pipe.Do(ctx).Err()
|
||||
Expect(err).To(Equal(errors.New("redis: please enter the command to be executed")))
|
||||
})
|
||||
|
||||
It("should process", func() {
|
||||
err := pipe.Process(ctx, redis.NewCmd(ctx, "asking"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(pipe.Cmds()).To(HaveLen(1))
|
||||
})
|
||||
|
||||
It("should batchProcess", func() {
|
||||
err := pipe.BatchProcess(ctx, redis.NewCmd(ctx, "asking"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(pipe.Cmds()).To(HaveLen(1))
|
||||
|
||||
pipe.Discard()
|
||||
Expect(pipe.Cmds()).To(HaveLen(0))
|
||||
|
||||
err = pipe.BatchProcess(ctx, redis.NewCmd(ctx, "asking"), redis.NewCmd(ctx, "set", "key", "value"))
|
||||
Expect(err).To(BeNil())
|
||||
Expect(pipe.Cmds()).To(HaveLen(2))
|
||||
})
|
||||
}
|
||||
|
||||
Describe("Pipeline", func() {
|
||||
|
Reference in New Issue
Block a user