From: Sergei Voronezhskii <sergw@tarantool.org> To: tarantool-patches@freelists.org Cc: Alexander Turenko <alexander.turenko@tarantool.org>, Vladimir Davydov <vdavydov.dev@gmail.com> Subject: [PATCH 3/4] test: increase timeout to check replica status Date: Fri, 5 Oct 2018 12:02:14 +0300 [thread overview] Message-ID: <20181005090215.6160-4-sergw@tarantool.org> (raw) In-Reply-To: <20181005090215.6160-1-sergw@tarantool.org> The replica status is checked 100 times, each check within `replica_timeout`. Refactor the code to get properly upstream. Then in loop with little sleep check upstreams status until it is not in follow mode. If count of checks is more than 200 break the loop with error. The value 200 and little sleep 0.001 choosed suitably to `replica_timeout` and `replica_connect_timeout`. Part of #2436, #3232 --- test/replication/misc.result | 22 ++++++++++++---------- test/replication/misc.test.lua | 22 ++++++++++++---------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/test/replication/misc.result b/test/replication/misc.result index c0c7d482d..937ef1b24 100644 --- a/test/replication/misc.result +++ b/test/replication/misc.result @@ -113,7 +113,7 @@ test_run:cmd("switch autobootstrap1") test_run = require('test_run').new() --- ... -box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} +box.cfg{replication_timeout = 0.2, replication_connect_timeout=0.2} --- ... test_run:cmd("switch autobootstrap2") @@ -123,7 +123,7 @@ test_run:cmd("switch autobootstrap2") test_run = require('test_run').new() --- ... -box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} +box.cfg{replication_timeout = 0.2, replication_connect_timeout=0.2} --- ... test_run:cmd("switch autobootstrap3") @@ -136,7 +136,7 @@ test_run = require('test_run').new() fiber=require('fiber') --- ... -box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} +box.cfg{replication_timeout = 0.2, replication_connect_timeout=0.2} --- ... _ = box.schema.space.create('test_timeout'):create_index('pk') @@ -147,15 +147,16 @@ test_run:cmd("setopt delimiter ';'") - true ... function test_timeout() + local replicaA = box.info.replication[1].upstream or box.info.replication[2].upstream + local replicaB = box.info.replication[3].upstream or box.info.replication[2].upstream for i = 0, 99 do box.space.test_timeout:replace({1}) - fiber.sleep(0.005) - local rinfo = box.info.replication - if rinfo[1].upstream and rinfo[1].upstream.status ~= 'follow' or - rinfo[2].upstream and rinfo[2].upstream.status ~= 'follow' or - rinfo[3].upstream and rinfo[3].upstream.status ~= 'follow' then - return error('Replication broken') - end + local n = 200 + repeat + fiber.sleep(0.001) + n = n - 1 + if n == 0 then return error(box.info.replication) end + until replicaA.status == 'follow' and replicaB.status == 'follow' end return true end ; @@ -165,6 +166,7 @@ test_run:cmd("setopt delimiter ''"); --- - true ... +-- the replica status is checked 100 times, each check within replication_timeout test_timeout() --- - true diff --git a/test/replication/misc.test.lua b/test/replication/misc.test.lua index 375c8b58a..cb658f6d0 100644 --- a/test/replication/misc.test.lua +++ b/test/replication/misc.test.lua @@ -43,30 +43,32 @@ test_run:create_cluster(SERVERS, "replication", {args="0.1"}) test_run:wait_fullmesh(SERVERS) test_run:cmd("switch autobootstrap1") test_run = require('test_run').new() -box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} +box.cfg{replication_timeout = 0.2, replication_connect_timeout=0.2} test_run:cmd("switch autobootstrap2") test_run = require('test_run').new() -box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} +box.cfg{replication_timeout = 0.2, replication_connect_timeout=0.2} test_run:cmd("switch autobootstrap3") test_run = require('test_run').new() fiber=require('fiber') -box.cfg{replication_timeout = 0.01, replication_connect_timeout=0.01} +box.cfg{replication_timeout = 0.2, replication_connect_timeout=0.2} _ = box.schema.space.create('test_timeout'):create_index('pk') test_run:cmd("setopt delimiter ';'") function test_timeout() + local replicaA = box.info.replication[1].upstream or box.info.replication[2].upstream + local replicaB = box.info.replication[3].upstream or box.info.replication[2].upstream for i = 0, 99 do box.space.test_timeout:replace({1}) - fiber.sleep(0.005) - local rinfo = box.info.replication - if rinfo[1].upstream and rinfo[1].upstream.status ~= 'follow' or - rinfo[2].upstream and rinfo[2].upstream.status ~= 'follow' or - rinfo[3].upstream and rinfo[3].upstream.status ~= 'follow' then - return error('Replication broken') - end + local n = 200 + repeat + fiber.sleep(0.001) + n = n - 1 + if n == 0 then return error(box.info.replication) end + until replicaA.status == 'follow' and replicaB.status == 'follow' end return true end ; test_run:cmd("setopt delimiter ''"); +-- the replica status is checked 100 times, each check within replication_timeout test_timeout() -- gh-3247 - Sequence-generated value is not replicated in case -- 2.18.0
next prev parent reply other threads:[~2018-10-05 9:02 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-09-27 15:38 [PATCH] test: enable parallel mode for replication tests Sergei Voronezhskii 2018-10-01 1:36 ` Alexander Turenko 2018-10-01 10:41 ` [tarantool-patches] " Alexander Turenko 2018-10-03 14:50 ` Sergei Voronezhskii 2018-10-05 9:02 ` Sergei Voronezhskii 2018-10-05 9:02 ` [PATCH 1/4] test: cleanup replication tests, parallel mode on Sergei Voronezhskii 2018-10-08 19:02 ` Alexander Turenko 2018-10-05 9:02 ` [PATCH 2/4] test: errinj for pause relay_send Sergei Voronezhskii 2018-10-08 19:07 ` Alexander Turenko 2018-10-05 9:02 ` Sergei Voronezhskii [this message] 2018-10-08 19:07 ` [PATCH 3/4] test: increase timeout to check replica status Alexander Turenko 2018-10-05 9:02 ` [PATCH 4/4] test: refactor some requirements to pass the runs Sergei Voronezhskii 2018-10-08 19:08 ` Alexander Turenko
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=20181005090215.6160-4-sergw@tarantool.org \ --to=sergw@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=tarantool-patches@freelists.org \ --cc=vdavydov.dev@gmail.com \ --subject='Re: [PATCH 3/4] test: increase timeout to check replica status' \ /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