From f4a151d3724d7c7f8e084535c18d7191cfed6d0c Mon Sep 17 00:00:00 2001 From: Jason Thomas Date: Tue, 5 Sep 2023 11:54:32 -0600 Subject: [PATCH] Type streamy (#275) 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 #, {"kind"=>"created", "type"=>"group", "data"=>"{\"name\":\"DEFAULT\",\"scope\":\"TEST\",\"updated_at\":1691767286666973366}"}], [#, {"kind"=>"deployed", "type"=>"group", "data"=>"{\"name\":\"DEFAULT\",\"scope\":\"TEST\",\"updated_at\":1691767286666973366}"}]}>, @last_id=#> 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 ... --- lib/mock_redis/database.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mock_redis/database.rb b/lib/mock_redis/database.rb index 13deb73..4691313 100644 --- a/lib/mock_redis/database.rb +++ b/lib/mock_redis/database.rb @@ -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