-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix parsing of INFO response (#3264)
If the INFO response contains a single `a=b` value for any of the keys, that must also be parsed into a dictionary. Fixes #3262 Co-authored-by: Gabriel Erzse <gabriel.erzse@redis.com>
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
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
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,35 @@ | ||
from redis._parsers.helpers import parse_info | ||
|
||
|
||
def test_parse_info(): | ||
info_output = """ | ||
# Modules | ||
module:name=search,ver=999999,api=1,filters=0,usedby=[],using=[ReJSON],options=[handle-io-errors] | ||
# search_fields_statistics | ||
search_fields_text:Text=3 | ||
search_fields_tag:Tag=2,Sortable=1 | ||
# search_version | ||
search_version:99.99.99 | ||
search_redis_version:7.2.2 - oss | ||
# search_runtime_configurations | ||
search_query_timeout_ms:500 | ||
""" | ||
info = parse_info(info_output) | ||
|
||
assert isinstance(info["modules"], list) | ||
assert isinstance(info["modules"][0], dict) | ||
assert info["modules"][0]["name"] == "search" | ||
|
||
assert isinstance(info["search_fields_text"], dict) | ||
assert info["search_fields_text"]["Text"] == 3 | ||
|
||
assert isinstance(info["search_fields_tag"], dict) | ||
assert info["search_fields_tag"]["Tag"] == 2 | ||
assert info["search_fields_tag"]["Sortable"] == 1 | ||
|
||
assert info["search_version"] == "99.99.99" | ||
assert info["search_redis_version"] == "7.2.2 - oss" | ||
assert info["search_query_timeout_ms"] == 500 |