You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by "PragmaTwice (via GitHub)" <gi...@apache.org> on 2025/05/12 07:59:29 UTC

Re: [PR] fix(zset): crash in ZRANDMEMBER for non-existent keys [kvrocks]

PragmaTwice commented on code in PR #2982:
URL: https://github.com/apache/kvrocks/pull/2982#discussion_r2084062489


##########
tests/gocase/unit/type/zset/zset_test.go:
##########
@@ -1324,6 +1324,10 @@ func basicTests(t *testing.T, rdb *redis.Client, ctx context.Context, enabledRES
 		}
 		createZset(rdb, ctx, "zset", z)
 
+		// ZRANDMEMBER key_not_exist
+		str := rdb.Do(ctx, "ZRANDMEMBER", "key_not_exist").Val()
+		require.Equal(t, redis.Nil, str.(string))
+
 		// ZRANDMEMBER zset
 		str := rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()

Review Comment:
   ```suggestion
   		str = rdb.Do(ctx, "ZRANDMEMBER", "zset").Val()
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org