1
0
Fork 0
mirror of https://github.com/Luzifer/cloudkeys-go.git synced 2024-11-14 17:02:43 +00:00
cloudkeys-go/vendor/github.com/xuyu/goredis/pipelining_test.go

31 lines
457 B
Go

package goredis
import (
"testing"
)
func TestPipelining(t *testing.T) {
p, err := r.Pipelining()
if err != nil {
t.Error(err)
}
defer p.Close()
n := 3
for i := 0; i < n; i++ {
if err := p.Command("PING"); err != nil {
t.Error(err)
}
}
rps, err := p.ReceiveAll()
if err != nil {
t.Error(err)
}
if len(rps) != n {
t.Fail()
}
if s, err := rps[1].StatusValue(); err != nil {
t.Error(err)
} else if s != "PONG" {
t.Fail()
}
}