diff options
author | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-10-15 12:54:53 +0200 |
---|---|---|
committer | Pieter Noordhuis <pcnoordhuis@gmail.com> | 2010-10-15 12:54:53 +0200 |
commit | 5a4f9f27e7982d2784c17dc053c8629e13c9d7e8 (patch) | |
tree | 47613af8552bbe138e30306cd1a61e0ba9637c0d /tests/unit | |
parent | 941c9fa2859cc4ce68911a1b5a8f88b53d802f77 (diff) | |
download | redis-5a4f9f27e7982d2784c17dc053c8629e13c9d7e8.tar.gz |
Add tests for OK on QUIT
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/quit.tcl | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/unit/quit.tcl b/tests/unit/quit.tcl new file mode 100644 index 000000000..4cf440abf --- /dev/null +++ b/tests/unit/quit.tcl @@ -0,0 +1,40 @@ +start_server {tags {"quit"}} { + proc format_command {args} { + set cmd "*[llength $args]\r\n" + foreach a $args { + append cmd "$[string length $a]\r\n$a\r\n" + } + set _ $cmd + } + + test "QUIT returns OK" { + reconnect + assert_equal OK [r quit] + assert_error * {r ping} + } + + test "Pipelined commands after QUIT must not be executed" { + reconnect + r write [format_command quit] + r write [format_command set foo bar] + r flush + assert_equal OK [r read] + assert_error * {r read} + + reconnect + assert_equal {} [r get foo] + } + + test "Pipelined commands after QUIT that exceed read buffer size" { + reconnect + r write [format_command quit] + r write [format_command set foo [string repeat "x" 1024]] + r flush + assert_equal OK [r read] + assert_error * {r read} + + reconnect + assert_equal {} [r get foo] + + } +} |