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