From: "Alexander V. Tikhonov" <avtikhon@tarantool.org> To: Kirill Yukhin <kyukhin@tarantool.org> Cc: Alexander Tikhonov <avtikhon@gmail.com>, tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v1 07/12] test: wait for xlog/snap/log file changes Date: Tue, 26 Nov 2019 09:21:43 +0300 [thread overview] Message-ID: <853cd53bd630fbe5d433038fc72dcad26f670eb8.1574749278.git.avtikhon@tarantool.org> (raw) In-Reply-To: <1c42ad20160f47d942cab405ce9896d6d31cc05f.1574749278.git.avtikhon@tarantool.org> In-Reply-To: <1c42ad20160f47d942cab405ce9896d6d31cc05f.1574749278.git.avtikhon@tarantool.org> From: Alexander Tikhonov <avtikhon@gmail.com> When a system in under heavy load (say, when tests are run in parallel) it is possible that disc writes stalls for some time. This can cause a fail of a check that a test performs, so now we retry such checks during 60 seconds until a condition will be met. This change targets replication test suite. (cherry picked from commit def75c88fce61d27baf62aabfc7a8e5b4126c73a) --- test/replication/gc_no_space.result | 18 ++++++++++-------- test/replication/gc_no_space.test.lua | 18 ++++++++++-------- test/replication/replica_rejoin.result | 10 +++++----- test/replication/replica_rejoin.test.lua | 6 +++--- test/replication/sync.result | 2 +- test/replication/sync.test.lua | 2 +- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/test/replication/gc_no_space.result b/test/replication/gc_no_space.result index 8e663cdf0..a7c7203c4 100644 --- a/test/replication/gc_no_space.result +++ b/test/replication/gc_no_space.result @@ -20,22 +20,24 @@ test_run:cmd("setopt delimiter ';'") --- - true ... -function check_file_count(dir, glob, count) - local files = fio.glob(fio.pathjoin(dir, glob)) - if #files == count then - return true - end - return false, files +function wait_file_count(dir, glob, count) + return test_run:wait_cond(function() + local files = fio.glob(fio.pathjoin(dir, glob)) + if #files == count then + return true + end + return false, files + end) end; --- ... function check_wal_count(count) - return check_file_count(box.cfg.wal_dir, '*.xlog', count) + return wait_file_count(box.cfg.wal_dir, '*.xlog', count) end; --- ... function check_snap_count(count) - return check_file_count(box.cfg.memtx_dir, '*.snap', count) + return wait_file_count(box.cfg.memtx_dir, '*.snap', count) end; --- ... diff --git a/test/replication/gc_no_space.test.lua b/test/replication/gc_no_space.test.lua index 4bab2b0e9..b0e4fedae 100644 --- a/test/replication/gc_no_space.test.lua +++ b/test/replication/gc_no_space.test.lua @@ -11,18 +11,20 @@ fio = require('fio') errinj = box.error.injection test_run:cmd("setopt delimiter ';'") -function check_file_count(dir, glob, count) - local files = fio.glob(fio.pathjoin(dir, glob)) - if #files == count then - return true - end - return false, files +function wait_file_count(dir, glob, count) + return test_run:wait_cond(function() + local files = fio.glob(fio.pathjoin(dir, glob)) + if #files == count then + return true + end + return false, files + end) end; function check_wal_count(count) - return check_file_count(box.cfg.wal_dir, '*.xlog', count) + return wait_file_count(box.cfg.wal_dir, '*.xlog', count) end; function check_snap_count(count) - return check_file_count(box.cfg.memtx_dir, '*.snap', count) + return wait_file_count(box.cfg.memtx_dir, '*.snap', count) end; test_run:cmd("setopt delimiter ''"); diff --git a/test/replication/replica_rejoin.result b/test/replication/replica_rejoin.result index c76332814..f71292da1 100644 --- a/test/replication/replica_rejoin.result +++ b/test/replication/replica_rejoin.result @@ -102,9 +102,9 @@ _ = box.space.test:insert{30} fio = require('fio') --- ... -#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1 +test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') --- -- 1 +- true ... box.cfg{checkpoint_count = checkpoint_count} --- @@ -203,9 +203,9 @@ for i = 1, 3 do box.space.test:insert{i * 100} end fio = require('fio') --- ... -#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1 +test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') --- -- 1 +- true ... box.cfg{checkpoint_count = checkpoint_count} --- @@ -330,7 +330,7 @@ box.cfg{checkpoint_count = default_checkpoint_count} fio = require('fio') --- ... -#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 +test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') --- - true ... diff --git a/test/replication/replica_rejoin.test.lua b/test/replication/replica_rejoin.test.lua index ca5fc5388..22a91d8d7 100644 --- a/test/replication/replica_rejoin.test.lua +++ b/test/replication/replica_rejoin.test.lua @@ -40,7 +40,7 @@ box.snapshot() _ = box.space.test:delete{3} _ = box.space.test:insert{30} fio = require('fio') -#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1 +test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') box.cfg{checkpoint_count = checkpoint_count} -- Restart the replica. Since xlogs have been removed, @@ -76,7 +76,7 @@ for i = 1, 3 do box.space.test:delete{i * 10} end box.snapshot() for i = 1, 3 do box.space.test:insert{i * 100} end fio = require('fio') -#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) -- 1 +test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') box.cfg{checkpoint_count = checkpoint_count} test_run:cmd("start server replica") test_run:cmd("switch replica") @@ -121,7 +121,7 @@ box.cfg{checkpoint_count = 1} box.snapshot() box.cfg{checkpoint_count = default_checkpoint_count} fio = require('fio') -#fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 +test_run:wait_cond(function() return #fio.glob(fio.pathjoin(box.cfg.wal_dir, '*.xlog')) == 1 end) or fio.pathjoin(box.cfg.wal_dir, '*.xlog') -- Bump vclock on the replica again. test_run:cmd("switch replica") for i = 1, 10 do box.space.test:replace{2} end diff --git a/test/replication/sync.result b/test/replication/sync.result index b2381ac59..862952fe6 100644 --- a/test/replication/sync.result +++ b/test/replication/sync.result @@ -286,7 +286,7 @@ box.info.replication[1].upstream.status -- follow --- - follow ... -test_run:grep_log('replica', 'ER_CFG.*') +test_run:wait_log("replica", "ER_CFG.*", nil, 200) --- - 'ER_CFG: Incorrect value for option ''replication'': duplicate connection with the same replica UUID' diff --git a/test/replication/sync.test.lua b/test/replication/sync.test.lua index 51131667d..500c5a396 100644 --- a/test/replication/sync.test.lua +++ b/test/replication/sync.test.lua @@ -140,7 +140,7 @@ box.cfg{replication = replication} box.info.status -- running box.info.ro -- false box.info.replication[1].upstream.status -- follow -test_run:grep_log('replica', 'ER_CFG.*') +test_run:wait_log("replica", "ER_CFG.*", nil, 200) test_run:cmd("switch default") test_run:cmd("stop server replica") -- 2.17.1
next prev parent reply other threads:[~2019-11-26 6:21 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-11-26 6:21 [Tarantool-patches] [PATCH v1 01/12] test: enable parallel mode for xlog tests Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 02/12] test: enable parallel run for long test suites Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 03/12] test: replication parallel mode on Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 04/12] test: enable cleaning of a test environment Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 05/12] test: allow to run replication/misc multiple times Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 06/12] test: increase timeouts in replication/errinj Alexander V. Tikhonov 2019-11-26 6:21 ` Alexander V. Tikhonov [this message] 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 08/12] test: use wait_cond to check follow status Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 09/12] test: increase timeouts in replication/misc Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 10/12] test: put require in proper places Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 11/12] test: fix replication/gc flaky failures Alexander V. Tikhonov 2019-11-26 6:21 ` [Tarantool-patches] [PATCH v1 12/12] test: errinj for pause relay_send Alexander V. Tikhonov 2019-11-26 6:54 ` [Tarantool-patches] [PATCH v1 01/12] test: enable parallel mode for xlog tests Kirill Yukhin
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=853cd53bd630fbe5d433038fc72dcad26f670eb8.1574749278.git.avtikhon@tarantool.org \ --to=avtikhon@tarantool.org \ --cc=avtikhon@gmail.com \ --cc=kyukhin@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v1 07/12] test: wait for xlog/snap/log file changes' \ /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