diff options
author | Oran Agra <oran@redislabs.com> | 2020-10-26 11:55:24 +0200 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2020-10-27 09:12:01 +0200 |
commit | de0919cd621766932f88fd4463b05cb1fa9addf9 (patch) | |
tree | fcbfb00828f6584710fbf4da9ba99f21c2990f27 | |
parent | 5aa0fef2ce0a0dcf3a11d1ccb386b5b447a90778 (diff) | |
download | redis-de0919cd621766932f88fd4463b05cb1fa9addf9.tar.gz |
Attempt to fix sporadic test failures due to wait_for_log_messages (#7955)
The tests sometimes fail to find a log message.
Recently i added a print that shows the log files that are searched
and it shows that the message was in deed there.
The only reason i can't think of for this seach to fail, is we we
happened to read an incomplete line, which didn't match our pattern and
then on the next iteration we would continue reading from the line after
it.
The fix is to always re-evaluation the previous line.
(cherry picked from commit 4e2e5be201439cae4c0a03cfc8b6a60be4bff625)
-rw-r--r-- | tests/support/util.tcl | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/support/util.tcl b/tests/support/util.tcl index 6e526fa94..970d63314 100644 --- a/tests/support/util.tcl +++ b/tests/support/util.tcl @@ -128,6 +128,8 @@ proc wait_for_log_messages {srv_idx patterns from_line maxtries delay} { set next_line [expr $from_line + 1] ;# searching form the line after set stdout [srv $srv_idx stdout] while {$retry} { + # re-read the last line (unless it's before to our first), last time we read it, it might have been incomplete + set next_line [expr $next_line - 1 > $from_line + 1 ? $next_line - 1 : $from_line + 1] set result [exec tail -n +$next_line < $stdout] set result [split $result "\n"] foreach line $result { |