grep_log() and wait_log() functions read log from max(0, filesize-X) position, where X is user-provided argument (64 KiB by default). It is possible that a previous test case or even a previous test (on the same tarantool server for core = tarantool tests) produces a log entry that is object of search in a current test case.
We can decrease X and hope that there will be enough log entries between the previous test case and the current one. We can add some padding log entries, but it appears to be fragile (don't know exact reason).
I propose to add a function like elide_log(), which will emit a log entry that will be taken into account by grep_log() and wait_log(). Usage:
diff --git a/test/vinyl/compact.test.lua b/test/vinyl/compact.test.lua
index 6c1e5731f..99930e2dc 100644
--- a/test/vinyl/compact.test.lua
+++ b/test/vinyl/compact.test.lua
@@ -13,11 +13,11 @@ vyinfo().run_count == 0
space:insert({1})
space:replace({1, 2})
space:upsert({1},{{'=', 4, 5}}) -- bad upsert
-require('log').info(string.rep(" ", 1024))
+test_run:elide_log()
space:select()
space:select()
-- gh-1571: bad upsert should not log on reads
-test_run:grep_log('default', 'UPSERT operation failed', 400) == nil
+test_run:grep_log('default', 'UPSERT operation failed') == nil
It both more stable and more readable (no magic numbers and so).
grep_log()andwait_log()functions read log frommax(0, filesize-X)position, whereXis user-provided argument (64 KiB by default). It is possible that a previous test case or even a previous test (on the same tarantool server forcore = tarantooltests) produces a log entry that is object of search in a current test case.We can decrease
Xand hope that there will be enough log entries between the previous test case and the current one. We can add some padding log entries, but it appears to be fragile (don't know exact reason).I propose to add a function like
elide_log(), which will emit a log entry that will be taken into account bygrep_log()andwait_log(). Usage:It both more stable and more readable (no magic numbers and so).