From: "Alexander V. Tikhonov" <avtikhon@tarantool.org> To: Kirill Yukhin <kyukhin@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v1] test: move error messages into logs gh-5383 Date: Mon, 5 Oct 2020 12:09:30 +0300 [thread overview] Message-ID: <3a077fc58da0e936d2e61901d539421b10b9a509.1601888900.git.avtikhon@tarantool.org> (raw) Set error message to log output in test: vinyl/gc.test.lua --- Github: https://github.com/tarantool/tarantool/tree/avtikhon/flaky-checksums test/vinyl/gc.result | 18 ++++++++++-------- test/vinyl/gc.test.lua | 16 +++++++++------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/test/vinyl/gc.result b/test/vinyl/gc.result index 11e316197..39cd3600b 100644 --- a/test/vinyl/gc.result +++ b/test/vinyl/gc.result @@ -39,10 +39,12 @@ function ls_data() return fio.glob(fio.pathjoin(path, '*')) end function ls_vylog() return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, '*.vylog')) end --- ... -function gc_info() return box.info.gc() end +function gc() temp:auto_increment{} box.snapshot() end --- ... -function gc() temp:auto_increment{} box.snapshot() end +function check_files_number(fnum) return (#files == fnum or \ + (require('log').error(files) or \ + require('log').error(box.info.gc()))) end --- ... -- Check that run files are deleted by gc. @@ -61,7 +63,7 @@ gc() files = ls_data() --- ... -#files == 2 or {files, gc_info()} +check_files_number(2) --- - true ... @@ -69,7 +71,7 @@ files = ls_data() files = ls_vylog() --- ... -#files == 2 or {files, gc_info()} +check_files_number(2) --- - true ... @@ -83,7 +85,7 @@ gc() files = ls_data() --- ... -#files == 0 or {files, gc_info()} +check_files_number(0) --- - true ... @@ -98,7 +100,7 @@ gc() files = ls_vylog() --- ... -#files == 2 or {files, gc_info()} +check_files_number(2) --- - true ... @@ -110,7 +112,7 @@ gc() files = ls_vylog() --- ... -#files == 1 or {files, gc_info()} +check_files_number(1) --- - true ... @@ -121,7 +123,7 @@ gc() files = ls_vylog() --- ... -#files == 0 or {files, gc_info()} +check_files_number(0) --- - true ... diff --git a/test/vinyl/gc.test.lua b/test/vinyl/gc.test.lua index 02cb6d32f..a95883a1a 100644 --- a/test/vinyl/gc.test.lua +++ b/test/vinyl/gc.test.lua @@ -19,8 +19,10 @@ path = fio.pathjoin(box.cfg.vinyl_dir, tostring(s.id), tostring(s.index.pk.id)) function ls_data() return fio.glob(fio.pathjoin(path, '*')) end function ls_vylog() return fio.glob(fio.pathjoin(box.cfg.vinyl_dir, '*.vylog')) end -function gc_info() return box.info.gc() end function gc() temp:auto_increment{} box.snapshot() end +function check_files_number(fnum) return (#files == fnum or \ + (require('log').error(files) or \ + require('log').error(box.info.gc()))) end -- Check that run files are deleted by gc. s:insert{1} box.snapshot() -- dump @@ -28,17 +30,17 @@ s:insert{2} box.snapshot() -- dump + compaction while s.index.pk:stat().run_count > 1 do fiber.sleep(0.01) end -- wait for compaction gc() files = ls_data() -#files == 2 or {files, gc_info()} +check_files_number(2) -- Check that gc keeps the current and previous log files. files = ls_vylog() -#files == 2 or {files, gc_info()} +check_files_number(2) -- Check that files left from dropped indexes are deleted by gc. s:drop() gc() files = ls_data() -#files == 0 or {files, gc_info()} +check_files_number(0) -- -- Check that vylog files are removed if vinyl is not used. @@ -48,18 +50,18 @@ files = ls_data() -- dropped index records are still stored in vylog. gc() files = ls_vylog() -#files == 2 or {files, gc_info()} +check_files_number(2) -- All records should have been purged from the log by now -- so we should only keep the previous log file. gc() files = ls_vylog() -#files == 1 or {files, gc_info()} +check_files_number(1) -- The previous log file should be removed by the next gc. gc() files = ls_vylog() -#files == 0 or {files, gc_info()} +check_files_number(0) temp:drop() -- 2.25.1
reply other threads:[~2020-10-05 9:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=3a077fc58da0e936d2e61901d539421b10b9a509.1601888900.git.avtikhon@tarantool.org \ --to=avtikhon@tarantool.org \ --cc=kyukhin@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1] test: move error messages into logs gh-5383' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox