mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
2e0f6724e0
In some tests, the code manually searches for a log message, and it uses tail -1 with a delay of 1 second, which can miss the expected line. Also, because the aof tests use start_server_aof and not start_server, the test name doesn't log into the server log. To fix the above, I made the following changes: - Change the start_server_aof to wrap the start_server. This will add the created aof server to the servers list, and make srv() and wait_for_log_messages() available for the tests. - Introduce a new option for start_server. 'wait_ready' - an option to let the caller start the test code without waiting for the server to be ready. useful for tests on a server that is expected to exit on startup. - Create a new start_server_aof_ex. The new proc also accept options as argument and make use of the new 'short_life' option for tests that are expected to exit on startup because of some error in the aof file(s). Because of the above, I had to change many lines and replace every local srv variable (a server config) usage with the srv().
38 lines
1.3 KiB
Tcl
38 lines
1.3 KiB
Tcl
source tests/support/aofmanifest.tcl
|
|
set defaults { appendonly {yes} appendfilename {appendonly.aof} appenddirname {appendonlydir} aof-use-rdb-preamble {no} }
|
|
set server_path [tmpdir server.aof]
|
|
|
|
tags {"aof external:skip"} {
|
|
# Specific test for a regression where internal buffers were not properly
|
|
# cleaned after a child responsible for an AOF rewrite exited. This buffer
|
|
# was subsequently appended to the new AOF, resulting in duplicate commands.
|
|
start_server_aof [list dir $server_path] {
|
|
set client [redis [srv host] [srv port] 0 $::tls]
|
|
set bench [open "|src/redis-benchmark -q -s [srv unixsocket] -c 20 -n 20000 incr foo" "r+"]
|
|
|
|
wait_for_condition 100 1 {
|
|
[$client get foo] > 0
|
|
} else {
|
|
# Don't care if it fails.
|
|
}
|
|
|
|
# Benchmark should be running by now: start background rewrite
|
|
$client bgrewriteaof
|
|
|
|
# Read until benchmark pipe reaches EOF
|
|
while {[string length [read $bench]] > 0} {}
|
|
|
|
waitForBgrewriteaof $client
|
|
|
|
# Check contents of foo
|
|
assert_equal 20000 [$client get foo]
|
|
}
|
|
|
|
# Restart server to replay AOF
|
|
start_server_aof [list dir $server_path] {
|
|
set client [redis [srv host] [srv port] 0 $::tls]
|
|
wait_done_loading $client
|
|
assert_equal 20000 [$client get foo]
|
|
}
|
|
}
|