Skip to content

Commit e9116db

Browse files
committed
add test
Signed-off-by: Xiaolong Chen <[email protected]>
1 parent 9bda236 commit e9116db

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

pipeline_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ var _ = Describe("pipelining", func() {
6060
Expect(cmds).To(BeEmpty())
6161
})
6262

63-
It("basic pipeline exec", func() {
63+
It("pipeline: basic exec", func() {
6464
p := client.Pipeline()
6565
p.Get(ctx, "key")
6666
p.Set(ctx, "key", "value", 0)
@@ -75,6 +75,24 @@ var _ = Describe("pipelining", func() {
7575
Expect(cmds[2].Err()).NotTo(HaveOccurred())
7676
})
7777

78+
It("pipeline: exec pipeline when get conn failed", func() {
79+
p := client.Pipeline()
80+
p.Get(ctx, "key")
81+
p.Set(ctx, "key", "value", 0)
82+
p.Get(ctx, "key")
83+
84+
client.Close()
85+
86+
cmds, err := p.Exec(ctx)
87+
Expect(err).To(Equal(redis.ErrClosed))
88+
Expect(cmds).To(HaveLen(3))
89+
for _, cmd := range cmds {
90+
Expect(cmd.Err()).To(Equal(redis.ErrClosed))
91+
}
92+
93+
client = redis.NewClient(redisOptions())
94+
})
95+
7896
assertPipeline := func() {
7997
It("returns no errors when there are no commands", func() {
8098
_, err := pipe.Exec(ctx)

0 commit comments

Comments
 (0)