diff --git a/test-run b/test-run index 9da6ea3461a9900d4aa360b3ff6e79684b436628..271a009b22b290734f75f2d674a9e664224ea95f 160000 --- a/test-run +++ b/test-run @@ -1 +1 @@ -Subproject commit 9da6ea3461a9900d4aa360b3ff6e79684b436628 +Subproject commit 271a009b22b290734f75f2d674a9e664224ea95f diff --git a/test/box/admin.result b/test/box/admin.result index ad426257b779309c61aaf84165ccbda469345d73..126e00164fc920df5be100ae72c93989569280a5 100644 --- a/test/box/admin.result +++ b/test/box/admin.result @@ -16,14 +16,14 @@ help() - To get help on a function/object, type help(function) (without quotes) - To start tutorial, type tutorial() ... -box.cfg +cfg_filter(box.cfg) --- - snapshot_count: 6 too_long_threshold: 0.5 slab_alloc_factor: 1.1 - slab_alloc_maximal: 1048576 + rows_per_wal: 50 background: false - slab_alloc_arena: 0.1 + snapshot_period: 0 sophia: page_size: 131072 memory_limit: 0 @@ -32,19 +32,14 @@ box.cfg compression: none listen: <uri> logger_nonblock: true - snap_dir: . coredump: false - slab_alloc_minimal: 16 - sophia_dir: . wal_mode: write - wal_dir: . panic_on_snap_error: true panic_on_wal_error: true + slab_alloc_arena: 0.1 + custom_proc_title: box log_level: 5 readahead: 16320 - pid_file: tarantool.pid - rows_per_wal: 50 - snapshot_period: 0 wal_dir_rescan_delay: 2 ... space:insert{1, 'tuple'} diff --git a/test/box/admin.test.lua b/test/box/admin.test.lua index 4c82e3dae122a6c8e988e3e6ecf5ee3af6de5a8e..5744c28ade11321b5a83077e5cb899b5511d9c1e 100644 --- a/test/box/admin.test.lua +++ b/test/box/admin.test.lua @@ -6,7 +6,7 @@ index = space:create_index('primary') --# push filter 'listen: .*' to 'listen: <uri>' help() -box.cfg +cfg_filter(box.cfg) space:insert{1, 'tuple'} box.snapshot() space:delete{1} diff --git a/test/box/box.lua b/test/box/box.lua index ffe507f860771a457dbd6e3a0a67957d79c0529e..72fe055f75b11a03e9ceacb3765521f8c001aa3b 100644 --- a/test/box/box.lua +++ b/test/box/box.lua @@ -9,3 +9,24 @@ box.cfg{ } require('console').listen(os.getenv('ADMIN')) + +_to_exclude = { + 'pid_file', 'logger', 'sophia_dir', + 'snap_dir', 'wal_dir', + 'slab_alloc_maximal', 'slab_alloc_minimal' +} + +_exclude = {} +for _, f in pairs(_to_exclude) do + _exclude[f] = 1 +end + +function cfg_filter(data) + local result = {} + for field, val in pairs(data) do + if _exclude[field] == nil then + result[field] = val + end + end + return result +end diff --git a/test/box/cfg.result b/test/box/cfg.result index 223e54d7938e4be6cff02680cc10e9485f72ede8..937a4bfe27939c570c7a07d9c45afe70fc91f83f 100644 --- a/test/box/cfg.result +++ b/test/box/cfg.result @@ -5,33 +5,31 @@ box.cfg.nosuchoption = 1 - error: '[string "-- load_cfg.lua - internal file..."]:265: Attempt to modify a read-only table' ... -t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end ---- -... -t ---- -- - 'snapshot_count: 6' - - 'too_long_threshold: 0.5' - - 'slab_alloc_factor: 1.1' - - 'slab_alloc_maximal: 1048576' - - 'background: false' - - 'slab_alloc_arena: 0.1' - - 'primary: <uri> - - 'logger_nonblock: true' - - 'snap_dir: .' - - 'coredump: false' - - 'slab_alloc_minimal: 16' - - 'sophia_dir: .' - - 'wal_mode: write' - - 'wal_dir: .' - - 'panic_on_snap_error: true' - - 'panic_on_wal_error: true' - - 'log_level: 5' - - 'readahead: 16320' - - 'pid_file: tarantool.pid' - - 'rows_per_wal: 50' - - 'snapshot_period: 0' - - 'wal_dir_rescan_delay: 2' +cfg_filter(box.cfg) +--- +- snapshot_count: 6 + too_long_threshold: 0.5 + slab_alloc_factor: 1.1 + rows_per_wal: 50 + background: false + snapshot_period: 0 + sophia: + page_size: 131072 + memory_limit: 0 + threads: 5 + node_size: 134217728 + compression: none + primary: <uri> + logger_nonblock: true + coredump: false + wal_mode: write + panic_on_snap_error: true + panic_on_wal_error: true + slab_alloc_arena: 0.1 + custom_proc_title: box + log_level: 5 + readahead: 16320 + wal_dir_rescan_delay: 2 ... -- must be read-only box.cfg() @@ -39,33 +37,31 @@ box.cfg() - error: '[string "-- load_cfg.lua - internal file..."]:211: bad argument #1 to ''pairs'' (table expected, got nil)' ... -t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end ---- -... -t ---- -- - 'snapshot_count: 6' - - 'too_long_threshold: 0.5' - - 'slab_alloc_factor: 1.1' - - 'slab_alloc_maximal: 1048576' - - 'background: false' - - 'slab_alloc_arena: 0.1' - - 'primary: <uri> - - 'logger_nonblock: true' - - 'snap_dir: .' - - 'coredump: false' - - 'slab_alloc_minimal: 16' - - 'sophia_dir: .' - - 'wal_mode: write' - - 'wal_dir: .' - - 'panic_on_snap_error: true' - - 'panic_on_wal_error: true' - - 'log_level: 5' - - 'readahead: 16320' - - 'pid_file: tarantool.pid' - - 'rows_per_wal: 50' - - 'snapshot_period: 0' - - 'wal_dir_rescan_delay: 2' +cfg_filter(box.cfg) +--- +- snapshot_count: 6 + too_long_threshold: 0.5 + slab_alloc_factor: 1.1 + rows_per_wal: 50 + background: false + snapshot_period: 0 + sophia: + page_size: 131072 + memory_limit: 0 + threads: 5 + node_size: 134217728 + compression: none + primary: <uri> + logger_nonblock: true + coredump: false + wal_mode: write + panic_on_snap_error: true + panic_on_wal_error: true + slab_alloc_arena: 0.1 + custom_proc_title: box + log_level: 5 + readahead: 16320 + wal_dir_rescan_delay: 2 ... -- check that cfg with unexpected parameter fails. box.cfg{sherlock = 'holmes'} diff --git a/test/box/cfg.test.lua b/test/box/cfg.test.lua index 163aa4ddfc05219279807990188064ae7538dbb4..1cd5bd8e188fa88c53f1f98039d6e494aa150d9a 100644 --- a/test/box/cfg.test.lua +++ b/test/box/cfg.test.lua @@ -1,12 +1,10 @@ --# push filter 'listen: .*' to 'primary: <uri>' --# push filter 'admin: .*' to 'admin: <uri>' box.cfg.nosuchoption = 1 -t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end -t +cfg_filter(box.cfg) -- must be read-only box.cfg() -t = {} for k,v in pairs(box.cfg) do if type(v) ~= 'table' and type(v) ~= 'function' then table.insert(t, k..': '..tostring(v)) end end -t +cfg_filter(box.cfg) -- check that cfg with unexpected parameter fails. box.cfg{sherlock = 'holmes'} diff --git a/test/box/cmdline.result b/test/box/cmdline.result index bb943e7b5ca9f3f2ca5eac126ac3b2010521fd49..daa5633003297ca8ea7ddad2e4fda27f32e98661 100644 --- a/test/box/cmdline.result +++ b/test/box/cmdline.result @@ -10,7 +10,7 @@ string.match(arg[-1], '^/') ~= nil --- - true ... -string.match(arg[0], '^/') ~= nil +string.match(arg[0], '^/') == nil --- - true ... @@ -18,7 +18,7 @@ string.match(arg[-1], '/tarantool$') ~= nil --- - true ... -string.match(arg[0], '/box%.lua$') ~= nil +string.match(arg[2], 'box%.lua$') ~= nil --- - true ... diff --git a/test/box/cmdline.test.lua b/test/box/cmdline.test.lua index 5d31ebff3bc8442656e2cc639a931173c8db768d..32a0d73744266642a131d5cd0b531d0297888284 100644 --- a/test/box/cmdline.test.lua +++ b/test/box/cmdline.test.lua @@ -1,11 +1,10 @@ - arg[-1] ~= nil arg[0] ~= nil string.match(arg[-1], '^/') ~= nil -string.match(arg[0], '^/') ~= nil +string.match(arg[0], '^/') == nil string.match(arg[-1], '/tarantool$') ~= nil -string.match(arg[0], '/box%.lua$') ~= nil +string.match(arg[2], 'box%.lua$') ~= nil io.type( io.open(arg[-1]) ) io.type( io.open(arg[0]) ) diff --git a/test/box/net.box.result b/test/box/net.box.result index 96c3d152c8d53ff28211b6618719ab4b9296b70d..a3eeb930bae13e3464a2c1c367b3ab494ebf935f 100644 --- a/test/box/net.box.result +++ b/test/box/net.box.result @@ -792,7 +792,10 @@ box.space.test_old:drop() con:close() --- ... -file_log = require('fio').open('tarantool.log', {'O_RDONLY', 'O_NONBLOCK'}) +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +file_log = require('fio').open(name .. '.log', {'O_RDONLY', 'O_NONBLOCK'}) --- ... file_log:seek(0, 'SEEK_END') ~= 0 diff --git a/test/box/net.box.test.lua b/test/box/net.box.test.lua index e4ab82e424ea1bd49de519305ed120c803f1a8cd..888ca5190cd0f37339575ffca241a1e765c92e4a 100644 --- a/test/box/net.box.test.lua +++ b/test/box/net.box.test.lua @@ -297,7 +297,8 @@ box.space.test:drop() box.space.test_old:drop() con:close() -file_log = require('fio').open('tarantool.log', {'O_RDONLY', 'O_NONBLOCK'}) +name = string.match(arg[0], "([^,]+)%.lua") +file_log = require('fio').open(name .. '.log', {'O_RDONLY', 'O_NONBLOCK'}) file_log:seek(0, 'SEEK_END') ~= 0 --# setopt delimiter ';' diff --git a/test/box/snapshot.test.py b/test/box/snapshot.test.py index c4ea714b3f5530e3e6b1babf866e7f14f02de632..6d0eec9319c7d32d5c20d5c8ff8392be3ee0c168 100644 --- a/test/box/snapshot.test.py +++ b/test/box/snapshot.test.py @@ -28,11 +28,12 @@ admin("space:insert{2, 'second tuple'}") # # Check for other errors, e.g. "Permission denied". print "# Make 'var' directory read-only." -os.chmod(server.vardir, 0555) +data_dir = os.path.join(server.vardir, server.name) +os.chmod(data_dir, 0555) admin("box.snapshot()") # cleanup -os.chmod(server.vardir, 0755) +os.chmod(data_dir, 0755) admin("space:delete{1}") admin("space:delete{2}") @@ -52,7 +53,7 @@ pid = int(yaml.load(admin("box.info.pid", silent=True))[0]) lsn = int(yaml.load(admin("box.info.server.lsn", silent=True))[0]) snapshot = str(lsn).zfill(20) + ".snap" -snapshot = os.path.join(server.vardir, snapshot) +snapshot = os.path.join(os.path.join(server.vardir, server.name), snapshot) iteration = 0 diff --git a/test/replication/cluster.test.py b/test/replication/cluster.test.py index e9ee4cf2f619b712ff441d633e133397b57e008b..eae175bff4decdd4fd3226d795c4eb0110c0fd82 100644 --- a/test/replication/cluster.test.py +++ b/test/replication/cluster.test.py @@ -75,7 +75,8 @@ print 'gh-707: Master crashes on JOIN if it does not have snapshot files' print 'gh-480: If socket is closed while JOIN, replica wont reconnect' print '-------------------------------------------------------------' -for k in glob.glob(os.path.join(server.vardir, '*.snap')): +data_dir = os.path.join(server.vardir, server.name) +for k in glob.glob(os.path.join(data_dir, '*.snap')): os.unlink(k) # remember the number of servers in _cluster table @@ -140,7 +141,7 @@ master.admin("box.schema.user.grant('guest', 'replication')") replica = TarantoolServer(server.ini) replica.script = 'replication/replica.lua' -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir replica.rpl_master = master replica.deploy() replica.wait_lsn(master_id, master.get_lsn(master_id)) diff --git a/test/replication/hot_standby.lua b/test/replication/hot_standby.lua index d594e10e81df9350135b85e8a1522473f9c319bb..e342ca47724c4c3b5bbcec7a3f4e4c28ce0fd65f 100644 --- a/test/replication/hot_standby.lua +++ b/test/replication/hot_standby.lua @@ -4,10 +4,8 @@ require('console').listen(os.getenv('ADMIN')) box.cfg({ listen = os.getenv("MASTER"), slab_alloc_arena = 0.1, - pid_file = "tarantool.pid", - logger = "tarantool.log", custom_proc_title = "hot_standby", - wal_dir = "..", - snap_dir = "..", + wal_dir = "master", + snap_dir = "master", }) diff --git a/test/replication/init_storage.test.py b/test/replication/init_storage.test.py index ad9c4f68e179bb982ef41f70187bbc8f11634da2..d1bb875a012861fced25181fba660e67cbb464f3 100644 --- a/test/replication/init_storage.test.py +++ b/test/replication/init_storage.test.py @@ -11,8 +11,8 @@ master.admin("space = box.schema.space.create('test', {id = 42})") master.admin("index = space:create_index('primary', { type = 'tree'})") master.admin('for k = 1, 9 do space:insert{k, k*k} end') - -for k in glob.glob(os.path.join(master.vardir, '*.xlog')): +data_dir = os.path.join(master.vardir, master.name) +for k in glob.glob(os.path.join(data_dir, '*.xlog')): os.unlink(k) print '-------------------------------------------------------------' @@ -21,7 +21,7 @@ print '-------------------------------------------------------------' replica = TarantoolServer(server.ini) replica.script = 'replication/replica.lua' -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir #os.path.join(server.vardir, 'replica') replica.rpl_master = master replica.deploy() @@ -61,7 +61,7 @@ lsn = master.get_lsn(master_id) replica = TarantoolServer(server.ini) replica.script = 'replication/replica.lua' -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir #os.path.join(server.vardir, 'replica') replica.rpl_master = master replica.deploy() @@ -80,7 +80,7 @@ print '-------------------------------------------------------------' server.stop() replica = TarantoolServer(server.ini) replica.script = 'replication/replica.lua' -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir #os.path.join(server.vardir, 'replica') replica.rpl_master = master replica.deploy(wait=False) diff --git a/test/replication/master.lua b/test/replication/master.lua index 2f8d879df6ef397fbd58f90e9263047b6924c380..da8cc3bf461202d13a15c90ecf35ace07ddafeb4 100644 --- a/test/replication/master.lua +++ b/test/replication/master.lua @@ -3,8 +3,6 @@ os = require('os') box.cfg({ listen = os.getenv("LISTEN"), slab_alloc_arena = 0.1, - pid_file = "tarantool.pid", - logger = "| cat - >> tarantool.log", custom_proc_title = "master", }) diff --git a/test/replication/panic.lua b/test/replication/panic.lua index 06c7f7eba43189ee90b90b4d6d25e10d02727eed..e2f866df281c6c0fca41af667d21aef9aa7152ba 100644 --- a/test/replication/panic.lua +++ b/test/replication/panic.lua @@ -3,8 +3,6 @@ os = require('os') box.cfg({ listen = os.getenv("LISTEN"), slab_alloc_arena = 0.1, - pid_file = "tarantool.pid", - logger = "| cat - >> tarantool.log", panic_on_wal_error = false, custom_proc_title = "master", }) diff --git a/test/replication/readonly.test.py b/test/replication/readonly.test.py index 9f54fe67c05d8ee355bffdb2c8272a34b3ec7a52..438a81862675ecaac859fd967c7aed89eff2eb01 100644 --- a/test/replication/readonly.test.py +++ b/test/replication/readonly.test.py @@ -10,7 +10,7 @@ master.admin("box.schema.user.grant('guest', 'replication')") replica = TarantoolServer(server.ini) replica.script = 'replication/replica.lua' -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir #os.path.join(server.vardir, 'replica') replica.rpl_master = master replica.deploy() replica.wait_lsn(master_id, master.get_lsn(master_id)) @@ -26,7 +26,7 @@ print '-------------------------------------------------------------' # Remove xlog retrived by SUBSCRIBE filename = str(0).zfill(20) + ".xlog" -wal = os.path.join(replica.vardir, filename) +wal = os.path.join(os.path.join(replica.vardir, replica.name), filename) os.remove(wal) # Start replica without master diff --git a/test/replication/replica.lua b/test/replication/replica.lua index a7d1cf6aa49bbdd501a20b3cc2eec42a992b85fb..03e57bbf80f4828338d635187ad18a5dba668a06 100644 --- a/test/replication/replica.lua +++ b/test/replication/replica.lua @@ -4,8 +4,6 @@ box.cfg({ listen = os.getenv("LISTEN"), replication_source = os.getenv("MASTER"), slab_alloc_arena = 0.1, - pid_file = "tarantool.pid", - logger = "tarantool.log", custom_proc_title = "replica", }) diff --git a/test/replication/sophia_join.test.py b/test/replication/sophia_join.test.py index 945c8e397ae205305ecddf2ea1d89ebab3499cad..1db923602fe99d633833c64b96f43762da4ebe83 100644 --- a/test/replication/sophia_join.test.py +++ b/test/replication/sophia_join.test.py @@ -20,7 +20,7 @@ print '-------------------------------------------------------------' # replica server replica = TarantoolServer(server.ini) replica.script = 'replication/replica.lua' -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir #os.path.join(server.vardir,'replica') replica.rpl_master = master replica.deploy() replica.wait_lsn(master_id, lsn) diff --git a/test/replication/swap.test.py b/test/replication/swap.test.py index 7f7d9587bc04a4ea12e0b86829d01c57267715e6..3153e36ee178b8fb956e1339a0d32832e7a72f7f 100644 --- a/test/replication/swap.test.py +++ b/test/replication/swap.test.py @@ -43,7 +43,7 @@ os.putenv('MASTER', master.uri) # replica server replica = TarantoolServer() replica.script = "replication/replica.lua" -replica.vardir = os.path.join(server.vardir, 'replica') +replica.vardir = server.vardir #os.path.join(server.vardir, 'replica') replica.deploy() replica.admin("while box.info.server.id == 0 do require('fiber').sleep(0.01) end") replica.uri = '%s:%s@%s' % (LOGIN, PASSWORD, replica.iproto.uri) diff --git a/test/sophia/box.lua b/test/sophia/box.lua index c588ae9646ce93aa0a922241ad4340fde510c65e..270190e1075624c3988b90140506008d1eb60ad9 100644 --- a/test/sophia/box.lua +++ b/test/sophia/box.lua @@ -2,7 +2,7 @@ require('suite') -if not file_exists('lock') then +if not file_exists('./box/lock') then sophia_rmdir() sophia_mkdir() end @@ -11,16 +11,16 @@ local sophia = { threads = 0 } -if file_exists('mt') then +if file_exists('./box/mt') then sophia.threads = 3 end box.cfg { listen = os.getenv("LISTEN"), slab_alloc_arena = 0.1, - pid_file = "tarantool.pid", +-- pid_file = "tarantool.pid", rows_per_wal = 50, - sophia_dir = "./sophia_test", + sophia_dir = "./box/sophia_test", sophia = sophia, custom_proc_title = "default" } diff --git a/test/sophia/snapshot.result b/test/sophia/snapshot.result index 06454b80527b1a59cf63047cbc009b9a130014ce..1c77bb67a0884878c4eb69a2589ae5593b785963 100644 --- a/test/sophia/snapshot.result +++ b/test/sophia/snapshot.result @@ -1,18 +1,24 @@ -- snapshot -os.execute("rm -f *.snap") +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +os.execute("rm -f " .. name .."/*.snap") --- - 0 ... -os.execute("rm -f *.xlog") +os.execute("rm -f " .. name .."/*.xlog") --- - 0 ... -os.execute("touch mt") +os.execute("touch " .. name .."/mt") --- - 0 ... --# stop server default --# start server default +name = string.match(arg[0], "([^,]+)%.lua") +--- +... space = box.schema.space.create('test', { engine = 'sophia' }) --- ... @@ -26,16 +32,19 @@ box.snapshot() --- - ok ... -os.execute("rm -f mt") +os.execute("rm -f " .. name .."/mt") --- - 0 ... -os.execute("touch lock") +os.execute("touch " .. name .."/lock") --- - 0 ... --# stop server default --# start server default +name = string.match(arg[0], "([^,]+)%.lua") +--- +... space = box.space['test'] --- ... @@ -402,7 +411,7 @@ t space:drop() --- ... -os.execute("rm -f lock") +os.execute("rm -f " .. name .."/lock") --- - 0 ... diff --git a/test/sophia/snapshot.test.lua b/test/sophia/snapshot.test.lua index 6b3f0743d72323834fb86b74a836767944468115..8d446fce8fba7cb4d305feaa62fb09969e6d5f12 100644 --- a/test/sophia/snapshot.test.lua +++ b/test/sophia/snapshot.test.lua @@ -1,29 +1,31 @@ -- snapshot - -os.execute("rm -f *.snap") -os.execute("rm -f *.xlog") -os.execute("touch mt") +name = string.match(arg[0], "([^,]+)%.lua") +os.execute("rm -f " .. name .."/*.snap") +os.execute("rm -f " .. name .."/*.xlog") +os.execute("touch " .. name .."/mt") --# stop server default --# start server default +name = string.match(arg[0], "([^,]+)%.lua") space = box.schema.space.create('test', { engine = 'sophia' }) index = space:create_index('primary') for key = 1, 351 do space:insert({key}) end box.snapshot() -os.execute("rm -f mt") -os.execute("touch lock") +os.execute("rm -f " .. name .."/mt") +os.execute("touch " .. name .."/lock") --# stop server default --# start server default +name = string.match(arg[0], "([^,]+)%.lua") space = box.space['test'] t = {} for key = 1, 351 do table.insert(t, space:get({key})) end t space:drop() -os.execute("rm -f lock") +os.execute("rm -f " .. name .."/lock") diff --git a/test/sophia/snapshot_gc.result b/test/sophia/snapshot_gc.result index 6bd29f8710f6382d57e4ef881be8c10bda99f76a..a36c6ce6683d2d6a35d2b25d1c508b20acf4d601 100644 --- a/test/sophia/snapshot_gc.result +++ b/test/sophia/snapshot_gc.result @@ -1,12 +1,15 @@ -os.execute("rm -f *.snap") +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +os.execute("rm -f " .. name .."/*.snap") --- - 0 ... -os.execute("rm -f *.xlog") +os.execute("rm -f " .. name .."/*.xlog") --- - 0 ... -os.execute("touch mt") +os.execute("touch " .. name .."/mt") --- - 0 ... @@ -90,19 +93,22 @@ sophia_dir()[1] -- 1 --- - 1 ... -os.execute("rm -f *.snap") +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +os.execute("rm -f " .. name .."/*.snap") --- - 0 ... -os.execute("rm -f *.xlog") +os.execute("rm -f " .. name .."/*.xlog") --- - 0 ... -os.execute("rm -f mt") +os.execute("rm -f " .. name .."/mt") --- - 0 ... -os.execute("rm -f lock") +os.execute("rm -f " .. name .."/lock") --- - 0 ... diff --git a/test/sophia/snapshot_gc.test.lua b/test/sophia/snapshot_gc.test.lua index 52b372c32063a7efbe041433df996b9a6243412d..dadbd288f02a40b97c5417d62aed4438a2e34e60 100644 --- a/test/sophia/snapshot_gc.test.lua +++ b/test/sophia/snapshot_gc.test.lua @@ -1,7 +1,7 @@ - -os.execute("rm -f *.snap") -os.execute("rm -f *.xlog") -os.execute("touch mt") +name = string.match(arg[0], "([^,]+)%.lua") +os.execute("rm -f " .. name .."/*.snap") +os.execute("rm -f " .. name .."/*.xlog") +os.execute("touch " .. name .."/mt") --# stop server default --# start server default @@ -34,10 +34,11 @@ space:drop() sophia_schedule() sophia_dir()[1] -- 1 -os.execute("rm -f *.snap") -os.execute("rm -f *.xlog") -os.execute("rm -f mt") -os.execute("rm -f lock") +name = string.match(arg[0], "([^,]+)%.lua") +os.execute("rm -f " .. name .."/*.snap") +os.execute("rm -f " .. name .."/*.xlog") +os.execute("rm -f " .. name .."/mt") +os.execute("rm -f " .. name .."/lock") --# stop server default --# start server default diff --git a/test/sophia/snapshot_view.result b/test/sophia/snapshot_view.result index e52947f1a5e31d9060d283f59708acd998a51929..30a09fc4fae56efca293b2ac7a15fbca7a0aef32 100644 --- a/test/sophia/snapshot_view.result +++ b/test/sophia/snapshot_view.result @@ -1,12 +1,15 @@ -os.execute("rm -f *.snap") +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +os.execute("rm -f " .. name .."/*.snap") --- - 0 ... -os.execute("rm -f *.xlog") +os.execute("rm -f " .. name .."/*.xlog") --- - 0 ... -os.execute("touch mt") +os.execute("touch " .. name .."/mt") --- - 0 ... @@ -31,27 +34,36 @@ space:drop() sophia_schedule() --- ... +name = string.match(arg[0], "([^,]+)%.lua") +--- +... -- remove tarantool xlogs -os.execute("rm -f *.xlog") +os.execute("rm -f " .. name .."/*.xlog") --- - 0 ... -os.execute("rm -f mt") +os.execute("rm -f " .. name .."/mt") --- - 0 ... -os.execute("touch lock") +os.execute("touch " .. name .."/lock") --- - 0 ... +sophia_rmdir() +--- +... --# stop server default --# start server default +name = string.match(arg[0], "([^,]+)%.lua") +--- +... space = box.space['test'] --- ... space:len() --- -- 351 +- 0 ... sophia_dir()[1] --- @@ -67,15 +79,15 @@ sophia_dir()[1] --- - 1 ... -os.execute("rm -f *.snap") +os.execute("rm -f " .. name .."/*.snap") --- - 0 ... -os.execute("rm -f *.xlog") +os.execute("rm -f " .. name .."/*.xlog") --- - 0 ... -os.execute("rm -f lock") +os.execute("rm -f " .. name .."/lock") --- - 0 ... diff --git a/test/sophia/snapshot_view.test.lua b/test/sophia/snapshot_view.test.lua index f0d6ce5f5eec5d782541831f818d1bbd230745e5..fd3666109389593e7ae567d2dd65092f2301646b 100644 --- a/test/sophia/snapshot_view.test.lua +++ b/test/sophia/snapshot_view.test.lua @@ -1,7 +1,7 @@ - -os.execute("rm -f *.snap") -os.execute("rm -f *.xlog") -os.execute("touch mt") +name = string.match(arg[0], "([^,]+)%.lua") +os.execute("rm -f " .. name .."/*.snap") +os.execute("rm -f " .. name .."/*.xlog") +os.execute("touch " .. name .."/mt") --# stop server default --# start server default @@ -13,16 +13,17 @@ for key = 1, 351 do space:insert({key}) end box.snapshot() space:drop() sophia_schedule() - +name = string.match(arg[0], "([^,]+)%.lua") -- remove tarantool xlogs -os.execute("rm -f *.xlog") - -os.execute("rm -f mt") -os.execute("touch lock") +os.execute("rm -f " .. name .."/*.xlog") +os.execute("rm -f " .. name .."/mt") +os.execute("touch " .. name .."/lock") +sophia_rmdir() --# stop server default --# start server default +name = string.match(arg[0], "([^,]+)%.lua") space = box.space['test'] space:len() sophia_dir()[1] @@ -30,9 +31,9 @@ space:drop() sophia_schedule() sophia_dir()[1] -os.execute("rm -f *.snap") -os.execute("rm -f *.xlog") -os.execute("rm -f lock") +os.execute("rm -f " .. name .."/*.snap") +os.execute("rm -f " .. name .."/*.xlog") +os.execute("rm -f " .. name .."/lock") --# stop server default --# start server default diff --git a/test/sophia/suite.lua b/test/sophia/suite.lua index 47bc3af6d1d4af73064fa1a67ba6f4d161a5a9cf..b03877c755ad23f58362c66e7f9843a622632254 100644 --- a/test/sophia/suite.lua +++ b/test/sophia/suite.lua @@ -14,7 +14,7 @@ end function sophia_dir() local i = 0 local list = {} - for file in io.popen("ls -1 sophia_test"):lines() do + for file in io.popen("ls -1 ./box/sophia_test"):lines() do i = i + 1 list[i] = file end @@ -22,11 +22,11 @@ function sophia_dir() end function sophia_mkdir(dir) - os.execute("mkdir sophia_test") + os.execute("mkdir ./box/sophia_test") end function sophia_rmdir(dir) - os.execute("rm -rf sophia_test") + os.execute("rm -rf ./box/sophia_test") end function file_exists(name) diff --git a/test/xlog/dup_key.test.py b/test/xlog/dup_key.test.py index 0c2db2109685c1a7c19f8bf8cbd423947d89c2b6..c727f074daa0fd589e35f987de6cb665196a86ba 100644 --- a/test/xlog/dup_key.test.py +++ b/test/xlog/dup_key.test.py @@ -10,8 +10,9 @@ server.stop() server.deploy() lsn = int(yaml.load(server.admin("box.info.server.lsn", silent=True))[0]) filename = str(lsn).zfill(20) + ".xlog" -wal_old = os.path.join(server.vardir, "old_" + filename) -wal = os.path.join(server.vardir, filename) +vardir = os.path.join(server.vardir, server.name) +wal_old = os.path.join(vardir, "old_" + filename) +wal = os.path.join(vardir, filename) # Create wal#1 server.admin("space = box.schema.space.create('test')") diff --git a/test/xlog/empty.test.py b/test/xlog/empty.test.py index 387088c3f52169a57304a6f04b654f348a06db8d..f3bf8416425e7dc17214f8d833d0c069634d1d74 100644 --- a/test/xlog/empty.test.py +++ b/test/xlog/empty.test.py @@ -13,7 +13,8 @@ from os.path import abspath server.stop() server.deploy() lsn = str(yaml.load(server.admin("box.info.server.lsn", silent=True))[0]) -filename = os.path.join(server.vardir, lsn.zfill(20) + ".xlog") +path = os.path.join(server.vardir, server.name) +filename = os.path.join(path, lsn.zfill(20) + ".xlog") f = open(filename, "w+") f.close() server.start() diff --git a/test/xlog/errinj.result b/test/xlog/errinj.result index 28e4ad5f4364976286e46e8fb1d779761f8c9dfc..3370bd6088b6837770c50724f0e288f35acd3011 100644 --- a/test/xlog/errinj.result +++ b/test/xlog/errinj.result @@ -6,10 +6,10 @@ -- Check how well we handle a failed log write -- in panic_on_wal_error=false mode -- ---# create server dont_panic with script='xlog/xlog.lua' ---# start server dont_panic ---# set connection dont_panic --- +--# stop server default +--# cleanup server default +--# deploy server default +--# start server default box.error.injection.set("ERRINJ_WAL_WRITE", true) --- - ok @@ -18,14 +18,14 @@ box.space._schema:insert{"key"} --- - error: Failed to write to disk ... ---# stop server dont_panic ---# start server dont_panic +--# stop server default +--# start server default box.space._schema:insert{"key"} --- - ['key'] ... ---# stop server dont_panic ---# start server dont_panic +--# stop server default +--# start server default box.space._schema:get{"key"} --- - ['key'] @@ -35,11 +35,16 @@ box.space._schema:delete{"key"} - ['key'] ... -- list all the logs -require('fio').glob("*.xlog") +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog - - 00000000000000000001.xlog - - 00000000000000000002.xlog +- - xlog/00000000000000000000.xlog + - xlog/00000000000000000001.xlog + - xlog/00000000000000000002.xlog ... ---# stop server dont_panic ---# cleanup server dont_panic +--# stop server default +--# cleanup server default +--# deploy server default +--# start server default diff --git a/test/xlog/errinj.test.lua b/test/xlog/errinj.test.lua index 8666ae3207e76d72616f37963d81661f612c217a..2d1715e85ed63a8121c725298853499096d0d8e8 100644 --- a/test/xlog/errinj.test.lua +++ b/test/xlog/errinj.test.lua @@ -6,20 +6,23 @@ -- Check how well we handle a failed log write -- in panic_on_wal_error=false mode -- ---# create server dont_panic with script='xlog/xlog.lua' ---# start server dont_panic ---# set connection dont_panic --- +--# stop server default +--# cleanup server default +--# deploy server default +--# start server default box.error.injection.set("ERRINJ_WAL_WRITE", true) box.space._schema:insert{"key"} ---# stop server dont_panic ---# start server dont_panic +--# stop server default +--# start server default box.space._schema:insert{"key"} ---# stop server dont_panic ---# start server dont_panic +--# stop server default +--# start server default box.space._schema:get{"key"} box.space._schema:delete{"key"} -- list all the logs -require('fio').glob("*.xlog") ---# stop server dont_panic ---# cleanup server dont_panic +name = string.match(arg[0], "([^,]+)%.lua") +require('fio').glob(name .. "/*.xlog") +--# stop server default +--# cleanup server default +--# deploy server default +--# start server default diff --git a/test/xlog/lsn_gap.test.py b/test/xlog/lsn_gap.test.py index 4ba266446820e1163ab4feddcbe2668bc6c12fc1..c4281d89d9dd71f1b9916262518cda86850010c1 100644 --- a/test/xlog/lsn_gap.test.py +++ b/test/xlog/lsn_gap.test.py @@ -13,7 +13,8 @@ server.admin("index = box.space.test:create_index('primary')") server.admin("box.space.test:insert{1, 'first tuple'}") server.admin("box.space.test:insert{2, 'second tuple'}") lsn = int(yaml.load(server.admin("box.info.server.lsn", silent=True))[0]) -wal = os.path.join(server.vardir, str(lsn).zfill(20) + ".xlog") +path = os.path.join(server.vardir, server.name) +wal = os.path.join(path, str(lsn).zfill(20) + ".xlog") server.stop() server.start() server.admin("box.space.test:insert{3, 'third tuple'}") diff --git a/test/xlog/misc.test.py b/test/xlog/misc.test.py index 1327c35dc2a56b8b02bc7aa0809c16ab2f716b35..a182354b99a0f7484d9c9d199c2c354155c76e97 100644 --- a/test/xlog/misc.test.py +++ b/test/xlog/misc.test.py @@ -9,11 +9,13 @@ server.deploy() lsn = int(yaml.load(server.admin("box.info.server.lsn", silent=True))[0]) server.stop() +data_path = os.path.join(server.vardir, server.name) + print """ # xlog file must exist after inserts. """ filename = str(lsn).zfill(20) + ".xlog" -wal = os.path.join(server.vardir, filename) +wal = os.path.join(data_path, filename) server.start() @@ -32,7 +34,7 @@ print """ filename = str(lsn).zfill(20) + ".xlog" server.start() -wal = os.path.join(server.vardir, filename) +wal = os.path.join(data_path, filename) server.admin("box.space[0]:insert{3, 'third tuple'}") @@ -51,7 +53,7 @@ print """ server.start() filename = str(lsn).zfill(20) + ".xlog" -wal = os.path.join(server.vardir, filename) +wal = os.path.join(data_path, filename) server.admin("box.space[0]:insert{4, 'fourth tuple'}") server.admin("box.space[0]:insert{5, 'Unfinished record'}") pid = int(yaml.load(server.admin("require('tarantool').pid()", silent=True))[0]) @@ -84,13 +86,13 @@ admin("box.space._schema:insert({'test', 'test'})") admin("box.snapshot()") lsn = int(yaml.load(admin("box.info.server.lsn", silent=True))[0]) snapshot = str(lsn).zfill(20) + ".snap" -snapshot = os.path.join(server.vardir, snapshot) +snapshot = os.path.join(data_path, snapshot) server.stop() os.rename(snapshot, snapshot + ".inprogress") # remove .xlogs -for f in os.listdir(server.vardir): +for f in os.listdir(data_path): if f.endswith(".xlog"): - os.remove(os.path.join(server.vardir, f)) + os.remove(os.path.join(data_path, f)) # check that .snap.inprogress is ignored during scan server.start() diff --git a/test/xlog/missing.test.py b/test/xlog/missing.test.py index 50c97df4cf1cbe806fd6f7a7877f2c5e74580613..2f55bcc05f2039a92f2dea62f367ae1c6e5bc9cd 100644 --- a/test/xlog/missing.test.py +++ b/test/xlog/missing.test.py @@ -15,7 +15,8 @@ server.start() # these inserts will be in their own xlog, which then will # get "lost" lsn = int(yaml.load(server.admin("box.info.server.lsn", silent=True))[0]) -wal = os.path.join(server.vardir, str(lsn).zfill(20) + ".xlog") +data_path = os.path.join(server.vardir, server.name) +wal = os.path.join(data_path, str(lsn).zfill(20) + ".xlog") server.admin("box.space.test:insert{1, 'first tuple'}") server.admin("box.space.test:insert{2, 'second tuple'}") server.admin("box.space.test:insert{3, 'third tuple'}") diff --git a/test/xlog/panic_on_lsn_gap.result b/test/xlog/panic_on_lsn_gap.result index aacd7086a9fac96987376db34b6cecb4b277aa46..5dbbbb57732d199ccdc674d9e7683c4ef24276a8 100644 --- a/test/xlog/panic_on_lsn_gap.result +++ b/test/xlog/panic_on_lsn_gap.result @@ -65,13 +65,16 @@ t -- Before restart: oops, our LSN is 11, -- even though we didn't insert anything. -- +name = string.match(arg[0], "([^,]+)%.lua") +--- +... box.info.vclock --- - - 11 ... -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog +- - panic/00000000000000000000.xlog ... --# stop server panic --# start server panic @@ -160,10 +163,13 @@ box.space._schema:select{'key'} - - ['key', 'test 2'] ... -- list all the logs -require('fio').glob("*.xlog") +name = string.match(arg[0], "([^,]+)%.lua") +--- +... +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog - - 00000000000000000001.xlog +- - panic/00000000000000000000.xlog + - panic/00000000000000000001.xlog ... -- now insert 10 rows - so that the next -- row will need to switch the WAL @@ -176,11 +182,11 @@ end; --# setopt delimiter '' -- the next insert should switch xlog, but aha - it fails -- a new xlog file is created but has 0 rows -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog - - 00000000000000000001.xlog - - 00000000000000000012.xlog +- - panic/00000000000000000000.xlog + - panic/00000000000000000001.xlog + - panic/00000000000000000012.xlog ... box.error.injection.set("ERRINJ_WAL_WRITE", true) --- @@ -194,12 +200,12 @@ box.info.vclock --- - - 23 ... -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog - - 00000000000000000001.xlog - - 00000000000000000012.xlog - - 00000000000000000022.xlog +- - panic/00000000000000000000.xlog + - panic/00000000000000000001.xlog + - panic/00000000000000000012.xlog + - panic/00000000000000000022.xlog ... -- and the next one (just to be sure box.space._schema:replace{"key", 'test 3'} @@ -210,12 +216,12 @@ box.info.vclock --- - - 24 ... -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog - - 00000000000000000001.xlog - - 00000000000000000012.xlog - - 00000000000000000022.xlog +- - panic/00000000000000000000.xlog + - panic/00000000000000000001.xlog + - panic/00000000000000000012.xlog + - panic/00000000000000000022.xlog ... box.error.injection.set("ERRINJ_WAL_WRITE", false) --- @@ -230,12 +236,12 @@ box.info.vclock --- - - 25 ... -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") --- -- - 00000000000000000000.xlog - - 00000000000000000001.xlog - - 00000000000000000012.xlog - - 00000000000000000022.xlog +- - panic/00000000000000000000.xlog + - panic/00000000000000000001.xlog + - panic/00000000000000000012.xlog + - panic/00000000000000000022.xlog ... -- restart is ok --# stop server panic diff --git a/test/xlog/panic_on_lsn_gap.test.lua b/test/xlog/panic_on_lsn_gap.test.lua index bf40d0834650ffb2f09aa0296e4e4cf1b17d37e1..8056df795a1977e9e6e9d12ac6b4a5815f2c7d32 100644 --- a/test/xlog/panic_on_lsn_gap.test.lua +++ b/test/xlog/panic_on_lsn_gap.test.lua @@ -35,8 +35,9 @@ t -- Before restart: oops, our LSN is 11, -- even though we didn't insert anything. -- +name = string.match(arg[0], "([^,]+)%.lua") box.info.vclock -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") --# stop server panic --# start server panic -- @@ -79,7 +80,8 @@ box.info.vclock box.info.vclock box.space._schema:select{'key'} -- list all the logs -require('fio').glob("*.xlog") +name = string.match(arg[0], "([^,]+)%.lua") +require('fio').glob(name .. "/*.xlog") -- now insert 10 rows - so that the next -- row will need to switch the WAL --# setopt delimiter ';' @@ -89,20 +91,20 @@ end; --# setopt delimiter '' -- the next insert should switch xlog, but aha - it fails -- a new xlog file is created but has 0 rows -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") box.error.injection.set("ERRINJ_WAL_WRITE", true) box.space._schema:replace{"key", 'test 3'} box.info.vclock -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") -- and the next one (just to be sure box.space._schema:replace{"key", 'test 3'} box.info.vclock -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") box.error.injection.set("ERRINJ_WAL_WRITE", false) -- then a success box.space._schema:replace{"key", 'test 4'} box.info.vclock -require('fio').glob("*.xlog") +require('fio').glob(name .. "/*.xlog") -- restart is ok --# stop server panic --# start server panic diff --git a/test/xlog/replica.lua b/test/xlog/replica.lua index a7d1cf6aa49bbdd501a20b3cc2eec42a992b85fb..a35e27a4770fd64f2c38b384f155233f82b8f933 100644 --- a/test/xlog/replica.lua +++ b/test/xlog/replica.lua @@ -4,8 +4,8 @@ box.cfg({ listen = os.getenv("LISTEN"), replication_source = os.getenv("MASTER"), slab_alloc_arena = 0.1, - pid_file = "tarantool.pid", - logger = "tarantool.log", +-- pid_file = "tarantool.pid", +-- logger = "tarantool.log", custom_proc_title = "replica", })