]> git.saurik.com Git - redis.git/blob - tests/unit/quit.tcl
Differentiate SCRIPT KILL error replies.
[redis.git] / tests / unit / quit.tcl
1 start_server {tags {"quit"}} {
2 proc format_command {args} {
3 set cmd "*[llength $args]\r\n"
4 foreach a $args {
5 append cmd "$[string length $a]\r\n$a\r\n"
6 }
7 set _ $cmd
8 }
9
10 test "QUIT returns OK" {
11 reconnect
12 assert_equal OK [r quit]
13 assert_error * {r ping}
14 }
15
16 test "Pipelined commands after QUIT must not be executed" {
17 reconnect
18 r write [format_command quit]
19 r write [format_command set foo bar]
20 r flush
21 assert_equal OK [r read]
22 assert_error * {r read}
23
24 reconnect
25 assert_equal {} [r get foo]
26 }
27
28 test "Pipelined commands after QUIT that exceed read buffer size" {
29 reconnect
30 r write [format_command quit]
31 r write [format_command set foo [string repeat "x" 1024]]
32 r flush
33 assert_equal OK [r read]
34 assert_error * {r read}
35
36 reconnect
37 assert_equal {} [r get foo]
38
39 }
40 }