提交 ba8367ee 编写于 作者: A antirez

Test: make sure broken RDB checksum is detected.

上级 67a74551
...@@ -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!"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册