mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 20:00:00 +00:00
56 lines
1.4 KiB
Tcl
56 lines
1.4 KiB
Tcl
start_server {tags {"protocol"}} {
|
|
test "Handle an empty query" {
|
|
reconnect
|
|
r write "\r\n"
|
|
r flush
|
|
assert_equal "PONG" [r ping]
|
|
}
|
|
|
|
test "Negative multibulk length" {
|
|
reconnect
|
|
r write "*-10\r\n"
|
|
r flush
|
|
assert_equal PONG [r ping]
|
|
}
|
|
|
|
test "Wrong multibulk payload header" {
|
|
reconnect
|
|
r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\nfooz\r\n"
|
|
r flush
|
|
assert_error "*expected '$', got 'f'*" {r read}
|
|
}
|
|
|
|
test "Negative multibulk payload length" {
|
|
reconnect
|
|
r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$-10\r\n"
|
|
r flush
|
|
assert_error "*invalid bulk length*" {r read}
|
|
}
|
|
|
|
test "Out of range multibulk payload length" {
|
|
reconnect
|
|
r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$2000000000\r\n"
|
|
r flush
|
|
assert_error "*invalid bulk length*" {r read}
|
|
}
|
|
|
|
test "Non-number multibulk payload length" {
|
|
reconnect
|
|
r write "*3\r\n\$3\r\nSET\r\n\$1\r\nx\r\n\$blabla\r\n"
|
|
r flush
|
|
assert_error "*invalid bulk length*" {r read}
|
|
}
|
|
|
|
test "Multi bulk request not followed by bulk arguments" {
|
|
reconnect
|
|
r write "*1\r\nfoo\r\n"
|
|
r flush
|
|
assert_error "*expected '$', got 'f'*" {r read}
|
|
}
|
|
|
|
test "Generic wrong number of args" {
|
|
reconnect
|
|
assert_error "*wrong*arguments*ping*" {r ping x y z}
|
|
}
|
|
}
|