Skip to content

Commit

Permalink
test: use default replication connection timeout
Browse files Browse the repository at this point in the history
All local connection timeout settings not related to the testing
scenario are removed within this change. Instead of removed values
the default one from src/box/lua/load_cfg.lua will be used.
The approach with a single default value helps to avoid flaky test
results regarding different timeout values and makes the future
maintainence easier.

The change is required for LSAN and ASAN testing machinery since it
introduces a little overhead and cause failures for tests with
excessively strict time limits.

Needed for #2058

(cherry picked from commit fb892b7)
  • Loading branch information
avtikhon authored and kyukhin committed Apr 2, 2020
1 parent 4954199 commit f0948d0
Show file tree
Hide file tree
Showing 29 changed files with 30 additions and 60 deletions.
2 changes: 0 additions & 2 deletions test/replication/autobootstrap.lua
Expand Up @@ -6,7 +6,6 @@ local USER = 'cluster'
local PASSWORD = 'somepassword'
local SOCKET_DIR = require('fio').cwd()
local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
--return 'localhost:'..(3310 + instance_id)
Expand All @@ -25,7 +24,6 @@ box.cfg({
USER..':'..PASSWORD..'@'..instance_uri(3);
};
replication_timeout = TIMEOUT;
replication_connect_timeout = CON_TIMEOUT;
})

box.once("bootstrap", function()
Expand Down
2 changes: 1 addition & 1 deletion test/replication/autobootstrap.result
Expand Up @@ -188,7 +188,7 @@ box.space.test_u:select()
_ = test_run:cmd("switch autobootstrap1")
---
...
_ = test_run:cmd("restart server autobootstrap1 with cleanup=1, args ='0.1 0.5'")
_ = test_run:cmd("restart server autobootstrap1 with cleanup=1, args ='0.1'")
_ = box.space.test_u:replace({5, 6, 7, 8})
---
...
Expand Down
2 changes: 1 addition & 1 deletion test/replication/autobootstrap.test.lua
Expand Up @@ -86,7 +86,7 @@ box.space.test_u:select()
-- Rebootstrap one node and check that others follow.
--
_ = test_run:cmd("switch autobootstrap1")
_ = test_run:cmd("restart server autobootstrap1 with cleanup=1, args ='0.1 0.5'")
_ = test_run:cmd("restart server autobootstrap1 with cleanup=1, args ='0.1'")

_ = box.space.test_u:replace({5, 6, 7, 8})
box.space.test_u:select()
Expand Down
2 changes: 0 additions & 2 deletions test/replication/autobootstrap_guest.lua
Expand Up @@ -6,7 +6,6 @@ local INSTANCE_ID = string.match(arg[0], "%d")
local SOCKET_DIR = require('fio').cwd()

local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
--return 'localhost:'..(3310 + instance_id)
Expand All @@ -25,7 +24,6 @@ box.cfg({
instance_uri(3);
};
replication_timeout = TIMEOUT;
replication_connect_timeout = CON_TIMEOUT;
})

box.once("bootstrap", function()
Expand Down
6 changes: 3 additions & 3 deletions test/replication/before_replace.result
Expand Up @@ -138,7 +138,7 @@ box.space.test:select()
- [9, 90]
- [10, 100]
...
test_run:cmd('restart server autobootstrap1 with args="0.1 0.5"')
test_run:cmd('restart server autobootstrap1 with args="0.1"')
box.space.test:select()
---
- - [1, 10]
Expand Down Expand Up @@ -169,7 +169,7 @@ box.space.test:select()
- [9, 90]
- [10, 100]
...
test_run:cmd('restart server autobootstrap2 with args="0.1 0.5"')
test_run:cmd('restart server autobootstrap2 with args="0.1"')
box.space.test:select()
---
- - [1, 10]
Expand Down Expand Up @@ -204,7 +204,7 @@ push_err
---
- Session 'applier' does not support push()
...
test_run:cmd('restart server autobootstrap3 with args="0.1 0.5"')
test_run:cmd('restart server autobootstrap3 with args="0.1"')
box.space.test:select()
---
- - [1, 10]
Expand Down
6 changes: 3 additions & 3 deletions test/replication/before_replace.test.lua
Expand Up @@ -65,16 +65,16 @@ vclock2 = test_run:wait_cluster_vclock(SERVERS, vclock)
-- and the state persists after restart.
test_run:cmd("switch autobootstrap1")
box.space.test:select()
test_run:cmd('restart server autobootstrap1 with args="0.1 0.5"')
test_run:cmd('restart server autobootstrap1 with args="0.1"')
box.space.test:select()
test_run:cmd("switch autobootstrap2")
box.space.test:select()
test_run:cmd('restart server autobootstrap2 with args="0.1 0.5"')
test_run:cmd('restart server autobootstrap2 with args="0.1"')
box.space.test:select()
test_run:cmd("switch autobootstrap3")
box.space.test:select()
push_err
test_run:cmd('restart server autobootstrap3 with args="0.1 0.5"')
test_run:cmd('restart server autobootstrap3 with args="0.1"')
box.space.test:select()

-- Cleanup.
Expand Down
2 changes: 0 additions & 2 deletions test/replication/ddl.lua
Expand Up @@ -7,7 +7,6 @@ local PASSWORD = 'somepassword'
local SOCKET_DIR = require('fio').cwd()

local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
--return 'localhost:'..(3310 + instance_id)
Expand All @@ -27,7 +26,6 @@ box.cfg({
USER..':'..PASSWORD..'@'..instance_uri(4);
};
replication_timeout = TIMEOUT,
replication_connect_timeout = CON_TIMEOUT,
})

box.once("bootstrap", function()
Expand Down
1 change: 0 additions & 1 deletion test/replication/hot_standby.lua
Expand Up @@ -10,6 +10,5 @@ box.cfg({
vinyl_dir = "master",
hot_standby = true,
replication_timeout = 0.1,
replication_connect_timeout = 0.5,
})

1 change: 0 additions & 1 deletion test/replication/master.lua
Expand Up @@ -3,7 +3,6 @@ os = require('os')
box.cfg({
listen = os.getenv("LISTEN"),
memtx_memory = 107374182,
replication_connect_timeout = 0.5,
replication_timeout = 0.1
})

Expand Down
2 changes: 0 additions & 2 deletions test/replication/master_quorum.lua
Expand Up @@ -6,7 +6,6 @@ local INSTANCE_ID = string.match(arg[0], "%d")
local SOCKET_DIR = require('fio').cwd()

local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
--return 'localhost:'..(3310 + instance_id)
Expand All @@ -25,7 +24,6 @@ box.cfg({
};
replication_connect_quorum = 0;
replication_timeout = TIMEOUT;
replication_connect_timeout = CON_TIMEOUT;
})

test_run = require('test_run').new()
Expand Down
2 changes: 0 additions & 2 deletions test/replication/on_replace.lua
Expand Up @@ -7,7 +7,6 @@ local PASSWORD = 'somepassword'
local SOCKET_DIR = require('fio').cwd()

local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
--return 'localhost:'..(3310 + instance_id)
Expand All @@ -28,7 +27,6 @@ box.cfg({
USER..':'..PASSWORD..'@'..instance_uri(2);
};
replication_timeout = TIMEOUT,
replication_connect_timeout = CON_TIMEOUT,
})

box.once("bootstrap", function()
Expand Down
2 changes: 0 additions & 2 deletions test/replication/quorum.lua
Expand Up @@ -6,7 +6,6 @@ local INSTANCE_ID = string.match(arg[0], "%d")
local SOCKET_DIR = require('fio').cwd()

local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
--return 'localhost:'..(3310 + instance_id)
Expand All @@ -20,7 +19,6 @@ box.cfg({
listen = instance_uri(INSTANCE_ID);
replication_timeout = TIMEOUT;
replication_sync_lag = 0.01;
replication_connect_timeout = CON_TIMEOUT;
replication_connect_quorum = 3;
replication = {
instance_uri(1);
Expand Down
15 changes: 7 additions & 8 deletions test/replication/quorum.result
Expand Up @@ -27,7 +27,7 @@ test_run:cmd('switch quorum2')
---
- true
...
test_run:cmd('restart server quorum2 with args="0.1 0.5"')
test_run:cmd('restart server quorum2 with args="0.1"')
box.info.status -- orphan
---
- orphan
Expand Down Expand Up @@ -55,7 +55,7 @@ box.info.status -- running
---
- running
...
test_run:cmd('restart server quorum2 with args="0.1 0.5"')
test_run:cmd('restart server quorum2 with args="0.1"')
box.info.status -- orphan
---
- orphan
Expand Down Expand Up @@ -86,7 +86,7 @@ box.info.status -- running
---
- running
...
test_run:cmd('restart server quorum2 with args="0.1 0.5"')
test_run:cmd('restart server quorum2 with args="0.1"')
box.info.status -- orphan
---
- orphan
Expand All @@ -103,7 +103,7 @@ box.space.test:replace{100} -- error
---
- error: Can't modify data because this instance is in read-only mode.
...
test_run:cmd('start server quorum1 with args="0.1 0.5"')
test_run:cmd('start server quorum1 with args="0.1"')
---
- true
...
Expand Down Expand Up @@ -166,7 +166,7 @@ fiber = require('fiber')
fiber.sleep(0.1)
---
...
test_run:cmd('start server quorum1 with args="0.1 0.5"')
test_run:cmd('start server quorum1 with args="0.1"')
---
- true
...
Expand Down Expand Up @@ -204,7 +204,7 @@ test_run:cmd('switch quorum1')
---
- true
...
test_run:cmd('restart server quorum1 with cleanup=1, args="0.1 0.5"')
test_run:cmd('restart server quorum1 with cleanup=1, args="0.1"')
test_run:wait_cond(function() return box.space.test:count() == 100 end, 20)
---
- true
Expand Down Expand Up @@ -419,10 +419,9 @@ test_run:cmd('create server replica_quorum with script="replication/replica_quor
- true
...
-- Arguments are: replication_connect_quorum, replication_timeout
-- replication_connect_timeout.
-- If replication_connect_quorum was ignored here, the instance
-- would exit with an error.
test_run:cmd('start server replica_quorum with wait=True, wait_load=True, args="1 0.05 0.1"')
test_run:cmd('start server replica_quorum with wait=True, wait_load=True, args="1 0.05"')
---
- true
...
Expand Down
15 changes: 7 additions & 8 deletions test/replication/quorum.test.lua
Expand Up @@ -18,7 +18,7 @@ test_run:cmd('stop server quorum1')

test_run:cmd('switch quorum2')

test_run:cmd('restart server quorum2 with args="0.1 0.5"')
test_run:cmd('restart server quorum2 with args="0.1"')
box.info.status -- orphan
box.ctl.wait_rw(0.001) -- timeout
box.info.ro -- true
Expand All @@ -27,7 +27,7 @@ box.space.test:replace{100} -- error
box.cfg{replication={}}
box.info.status -- running

test_run:cmd('restart server quorum2 with args="0.1 0.5"')
test_run:cmd('restart server quorum2 with args="0.1"')
box.info.status -- orphan
box.ctl.wait_rw(0.001) -- timeout
box.info.ro -- true
Expand All @@ -37,12 +37,12 @@ box.ctl.wait_rw()
box.info.ro -- false
box.info.status -- running

test_run:cmd('restart server quorum2 with args="0.1 0.5"')
test_run:cmd('restart server quorum2 with args="0.1"')
box.info.status -- orphan
box.ctl.wait_rw(0.001) -- timeout
box.info.ro -- true
box.space.test:replace{100} -- error
test_run:cmd('start server quorum1 with args="0.1 0.5"')
test_run:cmd('start server quorum1 with args="0.1"')
box.ctl.wait_rw()
box.info.ro -- false
box.info.status -- running
Expand All @@ -65,7 +65,7 @@ for i = 1, 100 do box.space.test:insert{i} end
fiber = require('fiber')
fiber.sleep(0.1)

test_run:cmd('start server quorum1 with args="0.1 0.5"')
test_run:cmd('start server quorum1 with args="0.1"')
test_run:cmd('switch quorum1')
test_run:wait_cond(function() return box.space.test:count() == 100 end, 20)

Expand All @@ -81,7 +81,7 @@ test_run:cmd('switch quorum2')
box.snapshot()

test_run:cmd('switch quorum1')
test_run:cmd('restart server quorum1 with cleanup=1, args="0.1 0.5"')
test_run:cmd('restart server quorum1 with cleanup=1, args="0.1"')

test_run:wait_cond(function() return box.space.test:count() == 100 end, 20)

Expand Down Expand Up @@ -157,10 +157,9 @@ test_run:drop_cluster(SERVERS)
box.schema.user.grant('guest', 'replication')
test_run:cmd('create server replica_quorum with script="replication/replica_quorum.lua"')
-- Arguments are: replication_connect_quorum, replication_timeout
-- replication_connect_timeout.
-- If replication_connect_quorum was ignored here, the instance
-- would exit with an error.
test_run:cmd('start server replica_quorum with wait=True, wait_load=True, args="1 0.05 0.1"')
test_run:cmd('start server replica_quorum with wait=True, wait_load=True, args="1 0.05"')
test_run:cmd('switch replica_quorum')
-- If replication_connect_quorum was ignored here, the instance
-- would exit with an error.
Expand Down
2 changes: 0 additions & 2 deletions test/replication/rebootstrap.lua
Expand Up @@ -6,7 +6,6 @@ local INSTANCE_ID = string.match(arg[0], "%d")
local SOCKET_DIR = require('fio').cwd()

local TIMEOUT = tonumber(arg[1])
local CON_TIMEOUT = arg[2] and tonumber(arg[2]) or 30.0

local function instance_uri(instance_id)
return SOCKET_DIR..'/rebootstrap'..instance_id..'.sock';
Expand All @@ -19,7 +18,6 @@ box.cfg({
listen = instance_uri(INSTANCE_ID),
instance_uuid = '12345678-abcd-1234-abcd-123456789ef' .. INSTANCE_ID,
replication_timeout = TIMEOUT,
replication_connect_timeout = CON_TIMEOUT,
replication = {
instance_uri(1);
instance_uri(2);
Expand Down
4 changes: 2 additions & 2 deletions test/replication/rebootstrap.result
Expand Up @@ -20,11 +20,11 @@ test_run:cmd('stop server rebootstrap1')
---
- true
...
test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1 2.0"')
test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1"')
---
- true
...
test_run:cmd('start server rebootstrap1 with args="0.1 0.5"')
test_run:cmd('start server rebootstrap1 with args="0.1"')
---
- true
...
Expand Down
4 changes: 2 additions & 2 deletions test/replication/rebootstrap.test.lua
Expand Up @@ -12,8 +12,8 @@ test_run:wait_fullmesh(SERVERS)
-- in 'orphan' mode.
--
test_run:cmd('stop server rebootstrap1')
test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1 2.0"')
test_run:cmd('start server rebootstrap1 with args="0.1 0.5"')
test_run:cmd('restart server rebootstrap2 with cleanup=True, wait=False, wait_load=False, args="0.1"')
test_run:cmd('start server rebootstrap1 with args="0.1"')
test_run:cmd('switch rebootstrap1')
box.info.status -- running

Expand Down
2 changes: 1 addition & 1 deletion test/replication/recover_missing_xlog.result
Expand Up @@ -69,7 +69,7 @@ fio.unlink(list[#list])
---
- true
...
test_run:cmd('start server autobootstrap1 with args="0.1 0.5"')
test_run:cmd('start server autobootstrap1 with args="0.1"')
---
- true
...
Expand Down
2 changes: 1 addition & 1 deletion test/replication/recover_missing_xlog.test.lua
Expand Up @@ -29,7 +29,7 @@ fio = require('fio')
-- in 'read-only' mode unless it receives all data.
list = fio.glob(fio.pathjoin(fio.abspath("."), 'autobootstrap1/*.xlog'))
fio.unlink(list[#list])
test_run:cmd('start server autobootstrap1 with args="0.1 0.5"')
test_run:cmd('start server autobootstrap1 with args="0.1"')

test_run:cmd("switch autobootstrap1")
for i = 10, 19 do box.space.test:insert{i, 'test' .. i} end
Expand Down
1 change: 0 additions & 1 deletion test/replication/replica.lua
Expand Up @@ -14,7 +14,6 @@ box.cfg({
replication = repl_list,
memtx_memory = 107374182,
replication_timeout = 0.1,
replication_connect_timeout = 0.5,
})

require('console').listen(os.getenv('ADMIN'))
2 changes: 0 additions & 2 deletions test/replication/replica_auth.lua
Expand Up @@ -2,13 +2,11 @@

local USER_PASS = arg[1]
local TIMEOUT = arg[2] and tonumber(arg[2]) or 0.1
local CON_TIMEOUT = arg[3] and tonumber(arg[3]) or 30.0

require('console').listen(os.getenv('ADMIN'))

box.cfg({
listen = os.getenv("LISTEN"),
replication = USER_PASS .. "@" .. os.getenv("MASTER"),
replication_timeout = TIMEOUT,
replication_connect_timeout = CON_TIMEOUT
})
1 change: 0 additions & 1 deletion test/replication/replica_no_quorum.lua
Expand Up @@ -6,7 +6,6 @@ box.cfg({
memtx_memory = 107374182,
replication_connect_quorum = 0,
replication_timeout = 0.1,
replication_connect_timeout = 0.5,
})

require('console').listen(os.getenv('ADMIN'))

0 comments on commit f0948d0

Please sign in to comment.