Skip to content

Commit

Permalink
Type streamy (#275)
Browse files Browse the repository at this point in the history
I think the recent change to scan that added the call to `type` is
breaking me because I'm using streams. I'm getting the following stack
trace:
```
    ArgumentError:
       Not sure how #<MockRedis::Stream:0x00007fcceb5db3e8 @members=#<Set: {[#<MockRedis::Stream::Id:0x00007fcceb5db2d0 @exclusive=false, @sequence=0, @timestamp=1691767286667>, {"kind"=>"created", "type"=>"group", "data"=>"{\"name\":\"DEFAULT\",\"scope\":\"TEST\",\"updated_at\":1691767286666973366}"}], [#<MockRedis::Stream::Id:0x00007fcceb5e3278 @exclusive=false, @sequence=1, @timestamp=1691767286667>, {"kind"=>"deployed", "type"=>"group", "data"=>"{\"name\":\"DEFAULT\",\"scope\":\"TEST\",\"updated_at\":1691767286666973366}"}]}>, @last_id=#<MockRedis::Stream::Id:0x00007fcceb5e3278 @exclusive=false, @sequence=1, @timestamp=1691767286667>> got in here
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/database.rb:271:in `type'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/utility_methods.rb:40:in `block in common_scan'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/utility_methods.rb:38:in `select'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/utility_methods.rb:38:in `common_scan'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/database.rb:155:in `scan'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/database.rb:162:in `block in scan_each'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/database.rb:161:in `loop'
     # ./vendor/bundle/ruby/3.1.0/gems/mock_redis-0.37.0/lib/mock_redis/database.rb:161:in `scan_each'
```

I think this addition to add `streamy` to `type` will fix it. Not sure
where in the tests this should go ...
  • Loading branch information
jmthomas authored Sep 5, 2023
1 parent 8b01807 commit f4a151d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/mock_redis/database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ def type(key)
'set'
elsif zsety?(key)
'zset'
elsif streamy?(key)
'stream'
else
raise ArgumentError, "Not sure how #{data[key].inspect} got in here"
end
Expand Down

0 comments on commit f4a151d

Please sign in to comment.