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
ae94fe7e
Commit
ae94fe7e
authored
Mar 13, 2013
by
antirez
Browse files
Test: make sure broken RDB checksum is detected.
parent
82b0eae6
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/integration/rdb.tcl
View file @
ae94fe7e
...
@@ -62,3 +62,22 @@ start_server_and_kill_it [list "dir" $server_path] {
...
@@ -62,3 +62,22 @@ start_server_and_kill_it [list "dir" $server_path] {
fail
"Server started even if RDB was unreadable!"
fail
"Server started even if RDB was unreadable!"
}
}
}
}
# Fix permissions of the RDB file, but corrupt its CRC64 checksum.
file attributes
[
file join $server_path dump.rdb
]
-permissions 0666
set filesize
[
file size
[
file join $server_path dump.rdb
]]
set fd
[
open
[
file join $server_path dump.rdb
]
r+
]
fconfigure $fd -translation binary
seek $fd -8 end
puts -nonewline $fd
"foobar00"
;
# Corrupt the checksum
close $fd
# Now make sure the server aborted with an error
start_server_and_kill_it
[
list
"dir"
$server_path
]
{
wait_for_condition 50 100
{
[
string match
{
*RDB checksum*
}
\
[
exec tail -n1 <
[
dict get $srv stdout
]]]
}
else
{
fail
"Server started even if RDB was corrupted!"
}
}
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