@@ -462,8 +462,7 @@ var _ = Describe("ClusterClient", func() {
462
462
Describe ("pipelining" , func () {
463
463
var pipe * redis.Pipeline
464
464
465
- assertPipeline := func () {
466
- keys := []string {"A" , "B" , "C" , "D" , "E" , "F" , "G" }
465
+ assertPipeline := func (keys []string ) {
467
466
468
467
It ("follows redirects" , func () {
469
468
if ! failover {
@@ -517,14 +516,14 @@ var _ = Describe("ClusterClient", func() {
517
516
})
518
517
519
518
It ("works with missing keys" , func () {
520
- pipe .Set (ctx , "A" , "A_value" , 0 )
521
- pipe .Set (ctx , "C" , "C_value" , 0 )
519
+ pipe .Set (ctx , "A{s} " , "A_value" , 0 )
520
+ pipe .Set (ctx , "C{s} " , "C_value" , 0 )
522
521
_ , err := pipe .Exec (ctx )
523
522
Expect (err ).NotTo (HaveOccurred ())
524
523
525
- a := pipe .Get (ctx , "A" )
526
- b := pipe .Get (ctx , "B" )
527
- c := pipe .Get (ctx , "C" )
524
+ a := pipe .Get (ctx , "A{s} " )
525
+ b := pipe .Get (ctx , "B{s} " )
526
+ c := pipe .Get (ctx , "C{s} " )
528
527
cmds , err := pipe .Exec (ctx )
529
528
Expect (err ).To (Equal (redis .Nil ))
530
529
Expect (cmds ).To (HaveLen (3 ))
@@ -547,7 +546,8 @@ var _ = Describe("ClusterClient", func() {
547
546
548
547
AfterEach (func () {})
549
548
550
- assertPipeline ()
549
+ keys := []string {"A" , "B" , "C" , "D" , "E" , "F" , "G" }
550
+ assertPipeline (keys )
551
551
552
552
It ("doesn't fail node with context.Canceled error" , func () {
553
553
ctx , cancel := context .WithCancel (context .Background ())
@@ -590,7 +590,10 @@ var _ = Describe("ClusterClient", func() {
590
590
591
591
AfterEach (func () {})
592
592
593
- assertPipeline ()
593
+ // TxPipeline doesn't support cross slot commands.
594
+ // Use hashtag to force all keys to the same slot.
595
+ keys := []string {"A{s}" , "B{s}" , "C{s}" , "D{s}" , "E{s}" , "F{s}" , "G{s}" }
596
+ assertPipeline (keys )
594
597
})
595
598
})
596
599
0 commit comments