forked from twitter/twemproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix multi DEL, a bug on parse key, and remove assert on conn_sendv
- Loading branch information
Showing
4 changed files
with
146 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python | ||
#coding: utf-8 | ||
#file : test_mget.py | ||
#author : ning | ||
#date : 2014-04-01 13:15:48 | ||
|
||
''' | ||
usage: | ||
export REDIS_HOST=127.0.0.1 | ||
export REDIS_PORT=4000 | ||
nosetests | ||
''' | ||
|
||
import os | ||
import redis | ||
|
||
host = os.environ['REDIS_HOST'] | ||
port = int(os.environ['REDIS_PORT']) | ||
|
||
|
||
def test_mget(cnt=1000): | ||
print 'test_many', cnt | ||
r = redis.StrictRedis(host, port) | ||
|
||
#insert | ||
pipe = r.pipeline(transaction=False) | ||
for i in range(cnt): | ||
pipe.set('kkk-%s'%i, 'vvv-%s'%i) | ||
pipe.execute() | ||
|
||
keys = ['kkk-%s' % i for i in range(cnt)] | ||
|
||
#mget to check | ||
vals = r.mget(keys) | ||
#print vals | ||
for i in range(cnt): | ||
assert('vvv-%s'%i == vals[i]) | ||
|
||
#del | ||
assert (cnt == r.delete(*keys) ) | ||
|
||
#mget again | ||
vals = r.mget(keys) | ||
for i in range(cnt): | ||
assert(None == vals[i]) | ||
|
||
def test_many_mget(): | ||
for i in range(1, 10000, 17): | ||
test_mget(i) | ||
pass | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters