Skip to content

Commit cbd3980

Browse files
test: wait until cluster leaders are rw
Tarantool 3.0 instances start in ro mode. It is possible that masters are not available for write requests right after test case has been started. Cartridge servers run only on Tarantool 1.x and 2.x, so they are expected to work fine without additional changes: Cartridge helpers checks are sophisticated enough. Part of #412 Part of #415
1 parent 9fefe3e commit cbd3980

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

test/integration/select_readview_test.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,6 +2307,8 @@ pgroup.test_stop_select = function(g)
23072307
g.cluster:server('s2-master'):start()
23082308

23092309
if g.params.backend == helpers.backend.VSHARD then
2310+
g.cluster:server('s2-master'):wait_for_rw()
2311+
23102312
local bootstrap_key
23112313
if type(g.params.backend_cfg) == 'table'
23122314
and g.params.backend_cfg.identification_mode == 'name_as_key' then

test/vshard_helpers/server.lua

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,16 @@ function Server:wait_for_readiness()
114114
end)
115115
end
116116

117+
function Server:wait_for_rw()
118+
return wait_cond('rw', self, function()
119+
local ok, is_ready = pcall(function()
120+
self:connect_net_box()
121+
return self.net_box:eval('return box.info.ro') == false
122+
end)
123+
return ok and is_ready
124+
end)
125+
end
126+
117127
function Server:wait_election_leader()
118128
-- Include read-only property too because if an instance is a leader, it
119129
-- does not mean it finished the synchro queue ownership transition. It is

test/vshard_helpers/vtest.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ local function cluster_new(g, cfg)
497497

498498
for _, master in pairs(masters) do
499499
master:wait_for_readiness()
500+
master:wait_for_rw()
500501
master:exec(function(cfg)
501502
-- Logged in as guest with 'super' access rights. Yet 'super' is not
502503
-- enough to grant 'replication' privilege. The simplest way - login

0 commit comments

Comments
 (0)