Skip to content

Commit 2e836ea

Browse files
committed
test to prove allocation_stats from 2.2 INFO doesn't cause parse_info to bomb anymore
1 parent b0cc6b9 commit 2e836ea

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

tests/server_commands.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime
44
import time
55
from distutils.version import StrictVersion
6+
from redis.client import parse_info
67

78
class ServerCommandsTestCase(unittest.TestCase):
89

@@ -1227,3 +1228,36 @@ def test_binary_lists(self):
12271228
# check that it is possible to get list content by key name
12281229
for key in mapping.keys():
12291230
self.assertEqual(self.client.lrange(key, 0, -1), list(mapping[key]))
1231+
1232+
def test_22_info(self):
1233+
"""
1234+
Older Redis versions contained 'allocation_stats' in INFO that
1235+
was the cause of a number of bugs when parsing.
1236+
"""
1237+
info = "allocation_stats:6=1,7=1,8=7141,9=180,10=92,11=116,12=5330," \
1238+
"13=123,14=3091,15=11048,16=225842,17=1784,18=814,19=12020," \
1239+
"20=2530,21=645,22=15113,23=8695,24=142860,25=318,26=3303," \
1240+
"27=20561,28=54042,29=37390,30=1884,31=18071,32=31367,33=160," \
1241+
"34=169,35=201,36=10155,37=1045,38=15078,39=22985,40=12523," \
1242+
"41=15588,42=265,43=1287,44=142,45=382,46=945,47=426,48=171," \
1243+
"49=56,50=516,51=43,52=41,53=46,54=54,55=75,56=647,57=332," \
1244+
"58=32,59=39,60=48,61=35,62=62,63=32,64=221,65=26,66=30,67=36," \
1245+
"68=41,69=44,70=26,71=144,72=169,73=24,74=37,75=25,76=42," \
1246+
"77=21,78=126,79=374,80=27,81=40,82=43,83=47,84=46,85=114," \
1247+
"86=34,87=37,88=7240,89=34,90=38,91=18,92=99,93=20,94=18," \
1248+
"95=17,96=15,97=22,98=18,99=69,100=17,101=22,102=15,103=29," \
1249+
"104=39,105=30,106=70,107=22,108=21,109=26,110=52,111=45," \
1250+
"112=33,113=67,114=41,115=44,116=48,117=53,118=54,119=51," \
1251+
"120=75,121=44,122=57,123=44,124=66,125=56,126=52,127=81," \
1252+
"128=108,129=70,130=50,131=51,132=53,133=45,134=62,135=12," \
1253+
"136=13,137=7,138=15,139=21,140=11,141=20,142=6,143=7,144=11," \
1254+
"145=6,146=16,147=19,148=1112,149=1,151=83,154=1,155=1,156=1," \
1255+
"157=1,160=1,161=1,162=2,166=1,169=1,170=1,171=2,172=1,174=1," \
1256+
"176=2,177=9,178=34,179=73,180=30,181=1,185=3,187=1,188=1," \
1257+
"189=1,192=1,196=1,198=1,200=1,201=1,204=1,205=1,207=1,208=1," \
1258+
"209=1,214=2,215=31,216=78,217=28,218=5,219=2,220=1,222=1," \
1259+
"225=1,227=1,234=1,242=1,250=1,252=1,253=1,>=256=203"
1260+
parsed = parse_info(info)
1261+
self.assert_('allocation_stats' in parsed)
1262+
self.assert_('6' in parsed['allocation_stats'])
1263+
self.assert_('>=256' in parsed['allocation_stats'])

0 commit comments

Comments
 (0)