diff options
author | chenyang8094 <chenyang8094@users.noreply.github.com> | 2022-01-25 04:31:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-24 22:31:35 +0200 |
commit | fa600496482dcfdbf4b5af7c27b7a2eda02ac586 (patch) | |
tree | 225e87b9243dd1216b8d3dd8f3c042db87f78eb2 | |
parent | 495ac8b79a4566abd05e201f06334cdd570258ef (diff) | |
download | redis-fa600496482dcfdbf4b5af7c27b7a2eda02ac586.tar.gz |
Fix EVAL timeout test failed on freebsd (#10098)
* Refactor EVAL timeout test
* since the test used r config set appendonly yes which generates a rewrite, it missed it's purpose
* Fix the bug that start_server returns before redis starts ready, which affects when multiple tests share the same dir.
* Elapsed time tracking no loner needed
Co-authored-by: Oran Agra <oran@redislabs.com>
-rw-r--r-- | tests/integration/aof.tcl | 22 | ||||
-rw-r--r-- | tests/support/server.tcl | 6 |
2 files changed, 16 insertions, 12 deletions
diff --git a/tests/integration/aof.tcl b/tests/integration/aof.tcl index bc88f2487..28b3b0e5e 100644 --- a/tests/integration/aof.tcl +++ b/tests/integration/aof.tcl @@ -478,26 +478,26 @@ tags {"aof external:skip"} { } test {EVAL timeout with slow verbatim Lua script from AOF} { - create_aof $aof_dirpath $aof_file { - append_to_aof [formatCommand select 9] - append_to_aof [formatCommand eval {redis.call('set',KEYS[1],'y'); for i=1,1500000 do redis.call('ping') end return 'ok'} 1 x] - } - - start_server [list overrides [list dir $server_path appendonly no lua-time-limit 1 aof-use-rdb-preamble no]] { + start_server [list overrides [list dir $server_path appendonly yes lua-time-limit 1 aof-use-rdb-preamble no]] { # generate a long running script that is propagated to the AOF as script # make sure that the script times out during loading + create_aof $aof_dirpath $aof_file { + append_to_aof [formatCommand select 9] + append_to_aof [formatCommand eval {redis.call('set',KEYS[1],'y'); for i=1,1500000 do redis.call('ping') end return 'ok'} 1 x] + } set rd [redis_deferring_client] - r config set appendonly yes - set start [clock clicks -milliseconds] $rd debug loadaof $rd flush - after 100 + wait_for_condition 100 10 { + [s loading] == 1 + } else { + fail "server didn't start loading" + } catch {r ping} err assert_match {LOADING*} $err $rd read - set elapsed [expr [clock clicks -milliseconds]-$start] - if {$::verbose} { puts "loading took $elapsed milliseconds" } $rd close + wait_for_log_messages 0 {"*Slow script detected*"} 0 100 100 assert_equal [r get x] y } } diff --git a/tests/support/server.tcl b/tests/support/server.tcl index a65fa8d7e..b06bd73ba 100644 --- a/tests/support/server.tcl +++ b/tests/support/server.tcl @@ -505,6 +505,10 @@ proc start_server {options {code undefined}} { close $fd } + # We may have a stdout left over from the previous tests, so we need + # to get the current count of ready logs + set previous_ready_count [count_message_lines $stdout "Ready to accept"] + # We need a loop here to retry with different ports. set server_started 0 while {$server_started == 0} { @@ -585,7 +589,7 @@ proc start_server {options {code undefined}} { while 1 { # check that the server actually started and is ready for connections - if {[count_message_lines $stdout "Ready to accept"] > 0} { + if {[count_message_lines $stdout "Ready to accept"] > $previous_ready_count} { break } after 10 |