From 5c0d64fd307b0d5788a9644deaa7fa795c712633 Mon Sep 17 00:00:00 2001 From: Sulverus <sulverus@gmail.com> Date: Fri, 5 Jun 2015 22:02:18 +0300 Subject: [PATCH] tests updated for new test-run set test-run module in gh-3 branch for review --- test-run | 2 +- test/box/admin.result | 15 ++-- test/box/admin.test.lua | 2 +- test/box/box.lua | 21 ++++++ test/box/cfg.result | 104 +++++++++++++------------- test/box/cfg.test.lua | 6 +- test/box/cmdline.result | 4 +- test/box/cmdline.test.lua | 5 +- test/box/net.box.result | 5 +- test/box/net.box.test.lua | 3 +- test/box/snapshot.test.py | 7 +- test/replication/cluster.test.py | 5 +- test/replication/hot_standby.lua | 6 +- test/replication/init_storage.test.py | 10 +-- test/replication/master.lua | 2 - test/replication/panic.lua | 2 - test/replication/readonly.test.py | 4 +- test/replication/replica.lua | 2 - test/replication/sophia_join.test.py | 2 +- test/replication/swap.test.py | 2 +- test/sophia/box.lua | 8 +- test/sophia/snapshot.result | 21 ++++-- test/sophia/snapshot.test.lua | 16 ++-- test/sophia/snapshot_gc.result | 20 +++-- test/sophia/snapshot_gc.test.lua | 17 +++-- test/sophia/snapshot_view.result | 32 +++++--- test/sophia/snapshot_view.test.lua | 25 ++++--- test/sophia/suite.lua | 6 +- test/xlog/dup_key.test.py | 5 +- test/xlog/empty.test.py | 3 +- test/xlog/errinj.result | 33 ++++---- test/xlog/errinj.test.lua | 25 ++++--- test/xlog/lsn_gap.test.py | 3 +- test/xlog/misc.test.py | 14 ++-- test/xlog/missing.test.py | 3 +- test/xlog/panic_on_lsn_gap.result | 54 +++++++------ test/xlog/panic_on_lsn_gap.test.lua | 14 ++-- test/xlog/replica.lua | 4 +- 38 files changed, 286 insertions(+), 226 deletions(-) diff --git a/test-run b/test-run index 9da6ea3461..271a009b22 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 ad426257b7..126e00164f 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 4c82e3dae1..5744c28ade 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 ffe507f860..72fe055f75 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 223e54d793..937a4bfe27 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 163aa4ddfc..1cd5bd8e18 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 bb943e7b5c..daa5633003 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 5d31ebff3b..32a0d73744 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 96c3d152c8..a3eeb930ba 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 e4ab82e424..888ca5190c 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 c4ea714b3f..6d0eec9319 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 e9ee4cf2f6..eae175bff4 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 d594e10e81..e342ca4772 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 ad9c4f68e1..d1bb875a01 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 2f8d879df6..da8cc3bf46 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 06c7f7eba4..e2f866df28 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 9f54fe67c0..438a818626 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 a7d1cf6aa4..03e57bbf80 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 945c8e397a..1db923602f 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 7f7d9587bc..3153e36ee1 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 c588ae9646..270190e107 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 06454b8052..1c77bb67a0 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 6b3f0743d7..8d446fce8f 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 6bd29f8710..a36c6ce668 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 52b372c320..dadbd288f0 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 e52947f1a5..30a09fc4fa 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 f0d6ce5f5e..fd36661093 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 47bc3af6d1..b03877c755 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 0c2db21096..c727f074da 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 387088c3f5..f3bf841642 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 28e4ad5f43..3370bd6088 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 8666ae3207..2d1715e85e 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 4ba2664468..c4281d89d9 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 1327c35dc2..a182354b99 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 50c97df4cf..2f55bcc05f 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 aacd7086a9..5dbbbb5773 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 bf40d08346..8056df795a 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 a7d1cf6aa4..a35e27a477 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", }) -- GitLab