Add randomkey command

This commit is contained in:
bijingrui
2023-04-09 21:46:05 +08:00
committed by finley
parent d0a7a215ba
commit 6103ca01c0
4 changed files with 26 additions and 0 deletions

View File

@@ -802,3 +802,13 @@ func TestBitPos(t *testing.T) {
actual = testDB.Exec(nil, utils.ToCmdLine("BitPos", key, "-1"))
asserts.AssertErrReply(t, actual, "ERR bit is not an integer or out of range")
}
func TestRandomkey(t *testing.T) {
testDB.Flush()
for i := 0; i < 10; i++ {
key := utils.RandString(10)
testDB.Exec(nil, utils.ToCmdLine2("SET", key, key))
}
actual := testDB.Exec(nil, utils.ToCmdLine("Randomkey"))
asserts.AssertNotError(t, actual)
}