Better truncated AOF loading tests.
Now there are tests to write more data after loading a truncated AOF, testing that the loaded data is correct, appending more, and testing again.
This commit is contained in:
parent
878c089ec9
commit
a2c740ea93
@ -39,14 +39,41 @@ tags {"aof"} {
|
|||||||
|
|
||||||
## Should also start with truncated AOF without incomplete MULTI block.
|
## Should also start with truncated AOF without incomplete MULTI block.
|
||||||
create_aof {
|
create_aof {
|
||||||
append_to_aof [formatCommand set foo hello]
|
append_to_aof [formatCommand incr foo]
|
||||||
append_to_aof [string range [formatCommand set bar world] 0 end-1]
|
append_to_aof [formatCommand incr foo]
|
||||||
|
append_to_aof [formatCommand incr foo]
|
||||||
|
append_to_aof [formatCommand incr foo]
|
||||||
|
append_to_aof [formatCommand incr foo]
|
||||||
|
append_to_aof [string range [formatCommand incr foo] 0 end-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
start_server_aof [list dir $server_path aof-load-truncated yes] {
|
start_server_aof [list dir $server_path aof-load-truncated yes] {
|
||||||
test "Short read: Server should start if load-truncated is yes" {
|
test "Short read: Server should start if load-truncated is yes" {
|
||||||
assert_equal 1 [is_alive $srv]
|
assert_equal 1 [is_alive $srv]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set client [redis [dict get $srv host] [dict get $srv port]]
|
||||||
|
|
||||||
|
test "Truncated AOF loaded: we expect foo to be equal to 5" {
|
||||||
|
assert {[$client get foo] eq "5"}
|
||||||
|
}
|
||||||
|
|
||||||
|
test "Append a new command after loading an incomplete AOF" {
|
||||||
|
$client incr foo
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Now the AOF file is expected to be correct
|
||||||
|
start_server_aof [list dir $server_path aof-load-truncated yes] {
|
||||||
|
test "Short read + command: Server should start" {
|
||||||
|
assert_equal 1 [is_alive $srv]
|
||||||
|
}
|
||||||
|
|
||||||
|
set client [redis [dict get $srv host] [dict get $srv port]]
|
||||||
|
|
||||||
|
test "Truncated AOF loaded: we expect foo to be equal to 6 now" {
|
||||||
|
assert {[$client get foo] eq "6"}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## Test that the server exits when the AOF contains a format error
|
## Test that the server exits when the AOF contains a format error
|
||||||
|
Loading…
x
Reference in New Issue
Block a user