summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy McCurdy <andy@andymccurdy.com>2011-05-25 14:54:45 -0700
committerAndy McCurdy <andy@andymccurdy.com>2011-05-25 14:54:45 -0700
commit2e836ea0b68b140cc265a7098092d3cd604dbafe (patch)
treeb91bf748348abb332462a56131801e01ec21fcbe
parentb0cc6b9662ac73a2083d18aa7c26f38ca3f5316b (diff)
downloadredis-py-2e836ea0b68b140cc265a7098092d3cd604dbafe.tar.gz
test to prove allocation_stats from 2.2 INFO doesn't cause parse_info to bomb anymore
-rw-r--r--tests/server_commands.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/server_commands.py b/tests/server_commands.py
index 361a954..806c6cb 100644
--- a/tests/server_commands.py
+++ b/tests/server_commands.py
@@ -3,6 +3,7 @@ import unittest
import datetime
import time
from distutils.version import StrictVersion
+from redis.client import parse_info
class ServerCommandsTestCase(unittest.TestCase):
@@ -1227,3 +1228,36 @@ class ServerCommandsTestCase(unittest.TestCase):
# check that it is possible to get list content by key name
for key in mapping.keys():
self.assertEqual(self.client.lrange(key, 0, -1), list(mapping[key]))
+
+ def test_22_info(self):
+ """
+ Older Redis versions contained 'allocation_stats' in INFO that
+ was the cause of a number of bugs when parsing.
+ """
+ info = "allocation_stats:6=1,7=1,8=7141,9=180,10=92,11=116,12=5330," \
+ "13=123,14=3091,15=11048,16=225842,17=1784,18=814,19=12020," \
+ "20=2530,21=645,22=15113,23=8695,24=142860,25=318,26=3303," \
+ "27=20561,28=54042,29=37390,30=1884,31=18071,32=31367,33=160," \
+ "34=169,35=201,36=10155,37=1045,38=15078,39=22985,40=12523," \
+ "41=15588,42=265,43=1287,44=142,45=382,46=945,47=426,48=171," \
+ "49=56,50=516,51=43,52=41,53=46,54=54,55=75,56=647,57=332," \
+ "58=32,59=39,60=48,61=35,62=62,63=32,64=221,65=26,66=30,67=36," \
+ "68=41,69=44,70=26,71=144,72=169,73=24,74=37,75=25,76=42," \
+ "77=21,78=126,79=374,80=27,81=40,82=43,83=47,84=46,85=114," \
+ "86=34,87=37,88=7240,89=34,90=38,91=18,92=99,93=20,94=18," \
+ "95=17,96=15,97=22,98=18,99=69,100=17,101=22,102=15,103=29," \
+ "104=39,105=30,106=70,107=22,108=21,109=26,110=52,111=45," \
+ "112=33,113=67,114=41,115=44,116=48,117=53,118=54,119=51," \
+ "120=75,121=44,122=57,123=44,124=66,125=56,126=52,127=81," \
+ "128=108,129=70,130=50,131=51,132=53,133=45,134=62,135=12," \
+ "136=13,137=7,138=15,139=21,140=11,141=20,142=6,143=7,144=11," \
+ "145=6,146=16,147=19,148=1112,149=1,151=83,154=1,155=1,156=1," \
+ "157=1,160=1,161=1,162=2,166=1,169=1,170=1,171=2,172=1,174=1," \
+ "176=2,177=9,178=34,179=73,180=30,181=1,185=3,187=1,188=1," \
+ "189=1,192=1,196=1,198=1,200=1,201=1,204=1,205=1,207=1,208=1," \
+ "209=1,214=2,215=31,216=78,217=28,218=5,219=2,220=1,222=1," \
+ "225=1,227=1,234=1,242=1,250=1,252=1,253=1,>=256=203"
+ parsed = parse_info(info)
+ self.assert_('allocation_stats' in parsed)
+ self.assert_('6' in parsed['allocation_stats'])
+ self.assert_('>=256' in parsed['allocation_stats'])