Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hset for Array of Key / Value Pairs #312

Merged
merged 3 commits into from
Nov 14, 2024
Merged

Conversation

jvanderen1
Copy link
Contributor

Fixes #310

This resolves an issue where Redis and MockRedis were storing values slightly differently:

With Redis:

require 'redis'
redis = Redis.new

hash = {:name=>"job", :namespace=>"default", :klass=>"Job"}
redis.hset("key", hash.flatten)

redis.hgetall("key")
=> {"name"=>"job", "namespace"=>"default", "klass"=>"Job"}

With MockRedis (with this change):

require 'mock_redis'
mock_redis = MockRedis.new

hash = {:name=>"job", :namespace=>"default", :klass=>"Job"}
mock_redis.hset("key", hash.flatten)

mock_redis.hgetall("key")
=> {"name"=>"job", "namespace"=>"default", "klass"=>"Job"}

@sds sds added the bug label Nov 14, 2024
@sds sds merged commit b242659 into sds:main Nov 14, 2024
11 checks passed
@jvanderen1 jvanderen1 deleted the jvanderen/310 branch November 14, 2024 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] MockRedis#hset behavior differs from Redis#hset when passing flattened array
2 participants