Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
06f8a473
Commit
06f8a473
authored
Jan 06, 2012
by
antirez
Browse files
Regression tests for protocol desync bug related to Issue #141
parent
11e0c4c5
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/unit/protocol.tcl
View file @
06f8a473
...
@@ -59,6 +59,37 @@ start_server {tags {"protocol"}} {
...
@@ -59,6 +59,37 @@ start_server {tags {"protocol"}} {
reconnect
reconnect
assert_error
"*wrong*arguments*ping*"
{
r ping x y z
}
assert_error
"*wrong*arguments*ping*"
{
r ping x y z
}
}
}
set c 0
foreach seq
[
list
"
\x00
"
"*
\x00
"
"
$
\x00
"
]
{
incr c
test
"Protocol desync regression test #
$c
"
{
set s
[
socket
[
srv 0 host
]
[
srv 0 port
]]
puts -nonewline $s $seq
set payload
[
string repeat A 1024
]
"
\n
"
set test_start
[
clock seconds
]
set test_time_limit 5
while 1
{
if
{[
catch
{
puts -nonewline $s payload
flush $s
incr payload_size
[
string length $payload
]
}]}
{
set retval
[
gets $s
]
close $s
break
}
else
{
set elapsed
[
expr
{[
clock seconds
]
-$test_start
}]
if
{
$elapsed
> $test_time_limit
}
{
close $s
error
"assertion:Redis did not closed connection after protocol desync"
}
}
}
set retval
}
{
*Protocol error*
}
}
unset c
}
}
start_server
{
tags
{
"regression"
}}
{
start_server
{
tags
{
"regression"
}}
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment