Add basic config_set / config_get support.#84
Open
yossigo wants to merge 4 commits intolocationlabs:masterfrom
Open
Add basic config_set / config_get support.#84yossigo wants to merge 4 commits intolocationlabs:masterfrom
yossigo wants to merge 4 commits intolocationlabs:masterfrom
Conversation
srikalyan
reviewed
Nov 8, 2016
mockredis/tests/test_config.py
Outdated
|
|
||
| def test_config_set(self): | ||
| eq_(self.redis.config_get('config-param'), {}) | ||
| self.redis.config_set('config-param', 'value') |
Contributor
There was a problem hiding this comment.
Can you also add a test for ints?
srikalyan
reviewed
Nov 9, 2016
mockredis/client.py
Outdated
| """ | ||
| Set a configuration parameter. | ||
| """ | ||
| self.redis_config[name] = value |
Contributor
There was a problem hiding this comment.
You should be returning "OK". For more info, http://redis.io/commands/config-set
Contributor
There was a problem hiding this comment.
Also, we get redis.exceptions.ResponseError: Unsupported CONFIG parameter: a for an invalid config. We probably need a list of configs to mimic the ResponseError. Not required for this PR though.
srikalyan
reviewed
Nov 9, 2016
mockredis/client.py
Outdated
| for name, value in self.redis_config.items(): | ||
| if fnmatch.fnmatch(name, pattern): | ||
| try: | ||
| result[name] = int(value) |
Contributor
There was a problem hiding this comment.
Sorry was just looking at the documentation and ran a quick test observed that
`
r.config_get("max--entries*")
{'zset-max-ziplist-entries': '128', 'hash-max-ziplist-entries': '512', 'set-max-intset-entries': '512'}
`
So basically you don't need to convert them into int.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a very basic implementation and it lacks defaults, special handling of multi-line config keywods, etc.