diff --git a/redis_test.go b/redis_test.go index b2169749..e91d6647 100644 --- a/redis_test.go +++ b/redis_test.go @@ -1426,7 +1426,7 @@ func (t *RedisTest) TestExecOnEmptyQueue(c *C) { //------------------------------------------------------------------------------ -func (t *RedisTest) TestConcAccess(c *C) { +func (t *RedisTest) TestRunningCommandsFromDifferentGoroutines(c *C) { for i := int64(0); i < 99; i++ { go func() { msg := "echo" + strconv.FormatInt(i, 10) @@ -1437,6 +1437,30 @@ func (t *RedisTest) TestConcAccess(c *C) { } } +func (t *RedisTest) TestPipeliningFromDifferentGoroutines(c *C) { + for i := int64(0); i < 99; i += 2 { + go func() { + msg1 := "echo" + strconv.FormatInt(i, 10) + msg2 := "echo" + strconv.FormatInt(i+1, 10) + + echo1Req := t.redisC.Echo(msg1) + echo2Req := t.redisC.Echo(msg2) + + reqs, err := t.redisC.RunQueued() + c.Check(reqs, HasLen, 2) + c.Check(err, IsNil) + + echo1, err := echo1Req.Reply() + c.Check(err, IsNil) + c.Check(echo1, Equals, msg1) + + echo2, err := echo2Req.Reply() + c.Check(err, IsNil) + c.Check(echo2, Equals, msg2) + }() + } +} + //------------------------------------------------------------------------------ func (t *RedisTest) BenchmarkRedisPing(c *C) {