From 1fe74027b543a45532d448098ded1c018216132b Mon Sep 17 00:00:00 2001 From: Sergey Bronnikov <sergeyb@tarantool.org> Date: Tue, 14 Jul 2020 20:54:32 +0000 Subject: [PATCH] luacheck: fix warnings in test/box Closes #5455 Reviewed-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Reviewed-by: Igor Munkin <imun@tarantool.org> Co-authored-by: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> Co-authored-by: Igor Munkin <imun@tarantool.org> --- .luacheckrc | 15 ++++++++- test/box/bitset.result | 15 +++++---- test/box/bitset.test.lua | 13 ++++---- test/box/box.lua | 4 +-- test/box/lua.result | 4 +-- test/box/lua.test.lua | 4 +-- test/box/lua/bitset.lua | 31 +++++++++++------- test/box/lua/cfg_bad_vinyl_dir.lua | 2 +- test/box/lua/cfg_rtree.lua | 2 +- test/box/lua/cfg_test1.lua | 2 +- test/box/lua/cfg_test2.lua | 2 +- test/box/lua/cfg_test3.lua | 2 +- test/box/lua/cfg_test4.lua | 2 +- test/box/lua/cfg_test5.lua | 2 +- test/box/lua/cfg_test6.lua | 2 +- test/box/lua/cfg_test8.lua | 2 +- test/box/lua/fifo.lua | 17 +++++++--- test/box/lua/identifier.lua | 11 +++---- test/box/lua/index_random_test.lua | 6 ++-- test/box/lua/push.lua | 5 +-- test/box/lua/txn_proxy.lua | 6 ++-- test/box/lua/utils.lua | 52 ++++++++---------------------- test/box/misc.result | 24 +++++++------- test/box/misc.test.lua | 24 +++++++------- test/box/on_schema_init.lua | 8 ++--- test/box/proxy.lua | 2 +- test/box/tiny.lua | 2 +- 27 files changed, 134 insertions(+), 127 deletions(-) diff --git a/.luacheckrc b/.luacheckrc index 102b2c9e8c..f61f6d5cb4 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -32,7 +32,13 @@ exclude_files = { "build/**/*.lua", "test-run/**/*.lua", "test/app/*.test.lua", - "test/box/**/*.lua", + "test/box/*.test.lua", + -- Unused source file, to be dropped (gh-5169). + "test/box/lua/require_init.lua", + -- Unused source file, to be dropped (gh-5169). + "test/box/lua/require_mod.lua", + -- Unused source file, to be dropped (gh-5169). + "test/box/lua/test_init.lua", "test/box-py/**/*.lua", "test/box-tap/**/*.lua", "test/engine/**/*.lua", @@ -101,3 +107,10 @@ files["src/box/lua/console.lua"] = { "212", } } +files["test/box/box.lua"] = { + globals = { + "cfg_filter", + "sorted", + "iproto_request", + } +} diff --git a/test/box/bitset.result b/test/box/bitset.result index 4808eea5cf..af3384d3f4 100644 --- a/test/box/bitset.result +++ b/test/box/bitset.result @@ -1,23 +1,26 @@ -dofile('bitset.lua') +bset = require('bitset') --- ... -create_space() +dump = bset.dump +--- +... +bset.create_space() --- ... ------------------------------------------------------------------------------ -- BitsetIndex: insert/delete ------------------------------------------------------------------------------ -test_insert_delete(128) +bset.test_insert_delete(128) --- - - $ 1$ ... ------------------------------------------------------------------------------ -- BitsetIndex: ALL ------------------------------------------------------------------------------ -clear() +bset.clear() --- ... -fill(1, 128) +bset.fill(1, 128) --- ... dump(box.index.BITS_ALL) @@ -1832,7 +1835,7 @@ dump(box.index.BITS_ANY_SET, 113) - $ 126$ - $ 127$ ... -drop_space() +bset.drop_space() --- ... ------------------------------------------------------------------------------ diff --git a/test/box/bitset.test.lua b/test/box/bitset.test.lua index d644d34e0b..cb7c408f57 100644 --- a/test/box/bitset.test.lua +++ b/test/box/bitset.test.lua @@ -1,17 +1,18 @@ -dofile('bitset.lua') +bset = require('bitset') -create_space() +dump = bset.dump +bset.create_space() ------------------------------------------------------------------------------ -- BitsetIndex: insert/delete ------------------------------------------------------------------------------ -test_insert_delete(128) +bset.test_insert_delete(128) ------------------------------------------------------------------------------ -- BitsetIndex: ALL ------------------------------------------------------------------------------ -clear() -fill(1, 128) +bset.clear() +bset.fill(1, 128) dump(box.index.BITS_ALL) box.space.tweedledum.index.bitset:count() ------------------------------------------------------------------------------ @@ -93,7 +94,7 @@ dump(box.index.BITS_ANY_SET, 7) dump(box.index.BITS_ANY_SET, 84) dump(box.index.BITS_ANY_SET, 113) -drop_space() +bset.drop_space() ------------------------------------------------------------------------------ -- Misc diff --git a/test/box/box.lua b/test/box/box.lua index 44d82ff0ac..567583533d 100644 --- a/test/box/box.lua +++ b/test/box/box.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') local msgpack = require('msgpack') @@ -20,7 +20,7 @@ local _hide = { function cfg_filter(data) if type(data)~='table' then return data end - local keys,k,_ = {} + local keys = {} for k in pairs(data) do table.insert(keys, k) end diff --git a/test/box/lua.result b/test/box/lua.result index 321bf92e03..4c14f200de 100644 --- a/test/box/lua.result +++ b/test/box/lua.result @@ -625,7 +625,7 @@ space = box.schema.space.create('tweedledum') tmp = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}, unique = true }) --- ... -dofile('push.lua') +push_collection = require('push') --- ... push_collection(space, 0, 1038784, 'hello') @@ -752,7 +752,7 @@ space:drop() -- -- index:random test -- -dofile('index_random_test.lua') +index_random_test = require('index_random_test') --- ... space = box.schema.space.create('tweedledum') diff --git a/test/box/lua.test.lua b/test/box/lua.test.lua index 475f4813ed..9762e07eb2 100644 --- a/test/box/lua.test.lua +++ b/test/box/lua.test.lua @@ -225,7 +225,7 @@ space:drop() space = box.schema.space.create('tweedledum') tmp = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}, unique = true }) -dofile('push.lua') +push_collection = require('push') push_collection(space, 0, 1038784, 'hello') push_collection(space, 0, 1038784, 'hello') @@ -277,7 +277,7 @@ space:drop() -- -- index:random test -- -dofile('index_random_test.lua') +index_random_test = require('index_random_test') space = box.schema.space.create('tweedledum') tmp = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}, unique = true }) tmp = space:create_index('secondary', { type = 'hash', parts = {1, 'unsigned'}, unique = true }) diff --git a/test/box/lua/bitset.lua b/test/box/lua/bitset.lua index 41d2c36813..245e9f097c 100644 --- a/test/box/lua/bitset.lua +++ b/test/box/lua/bitset.lua @@ -1,45 +1,42 @@ local utils = require('utils') -local SPACE_NO = 0 -local INDEX_NO = 1 - -function create_space() +local function create_space() local space = box.schema.create_space('tweedledum') space:create_index('primary', { type = 'hash', parts = {1, 'unsigned'}, unique = true }) space:create_index('bitset', { type = 'bitset', parts = {2, 'unsigned'}, unique = false }) end -function fill(...) +local function fill(...) local space = box.space['tweedledum'] local nums = utils.table_generate(utils.arithmetic(...)) utils.table_shuffle(nums) - for _k, v in ipairs(nums) do + for _, v in ipairs(nums) do space:insert{v, v} end end -function delete(...) +local function delete(...) local space = box.space['tweedledum'] local nums = utils.table_generate(utils.arithmetic(...)) utils.table_shuffle(nums) - for _k, v in ipairs(nums) do + for _, v in ipairs(nums) do space:delete{v} end end -function clear() +local function clear() box.space['tweedledum']:truncate() end -function drop_space() +local function drop_space() box.space['tweedledum']:drop() end -function dump(...) +local function dump(...) return utils.iterate('tweedledum', 'bitset', 1, 2, ...) end -function test_insert_delete(n) +local function test_insert_delete(n) local t = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127} @@ -51,3 +48,13 @@ function test_insert_delete(n) for _, v in ipairs(t) do delete(v, n / v) end return dump(box.index.BITS_ALL) end + +return { + clear = clear, + create_space = create_space, + delete = delete, + drop_space = drop_space, + dump = dump, + fill = fill, + test_insert_delete = test_insert_delete, +} diff --git a/test/box/lua/cfg_bad_vinyl_dir.lua b/test/box/lua/cfg_bad_vinyl_dir.lua index 8e1a98dc83..82746b99a0 100644 --- a/test/box/lua/cfg_bad_vinyl_dir.lua +++ b/test/box/lua/cfg_bad_vinyl_dir.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_rtree.lua b/test/box/lua/cfg_rtree.lua index f2d32ef7d7..860cb14a84 100644 --- a/test/box/lua/cfg_rtree.lua +++ b/test/box/lua/cfg_rtree.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.error.injection.set("ERRINJ_INDEX_RESERVE", true) box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test1.lua b/test/box/lua/cfg_test1.lua index 60b7aff9a9..aa026ed425 100644 --- a/test/box/lua/cfg_test1.lua +++ b/test/box/lua/cfg_test1.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test2.lua b/test/box/lua/cfg_test2.lua index 2397f9c19a..536661698e 100644 --- a/test/box/lua/cfg_test2.lua +++ b/test/box/lua/cfg_test2.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test3.lua b/test/box/lua/cfg_test3.lua index 6a6e544b69..4978900fb8 100644 --- a/test/box/lua/cfg_test3.lua +++ b/test/box/lua/cfg_test3.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test4.lua b/test/box/lua/cfg_test4.lua index 82dab8757c..21a38f95c0 100644 --- a/test/box/lua/cfg_test4.lua +++ b/test/box/lua/cfg_test4.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test5.lua b/test/box/lua/cfg_test5.lua index e3eb87392f..d462c3bbc3 100644 --- a/test/box/lua/cfg_test5.lua +++ b/test/box/lua/cfg_test5.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test6.lua b/test/box/lua/cfg_test6.lua index efcfc6f3e1..0a5859bc58 100644 --- a/test/box/lua/cfg_test6.lua +++ b/test/box/lua/cfg_test6.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/cfg_test8.lua b/test/box/lua/cfg_test8.lua index c61b86ae3c..edc666ea9d 100644 --- a/test/box/lua/cfg_test8.lua +++ b/test/box/lua/cfg_test8.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/lua/fifo.lua b/test/box/lua/fifo.lua index bb3446179d..3288c8be82 100644 --- a/test/box/lua/fifo.lua +++ b/test/box/lua/fifo.lua @@ -1,15 +1,15 @@ -- {name, top, bottom, fifo...} -fifomax = 5 -function find_or_create_fifo(space, name) +local fifomax = 5 +local function find_or_create_fifo(space, name) local fifo = space:get{name} if fifo == nil then fifo = {} - for i = 1, fifomax do table.insert(fifo, 0) end + for _ = 1, fifomax do table.insert(fifo, 0) end fifo = space:insert{name, 4, 4, unpack(fifo)} end return fifo end -function fifo_push(space, name, val) +local function fifo_push(space, name, val) local fifo = find_or_create_fifo(space, name) local top = fifo[2] local bottom = fifo[3] @@ -25,8 +25,15 @@ function fifo_push(space, name, val) end return space:update({name}, {{'=', 2, top}, {'=', 3, bottom }, {'=', top, val}}) end -function fifo_top(space, name) +local function fifo_top(space, name) local fifo = find_or_create_fifo(space, name) local top = fifo[2] return fifo[top] end + +return { + find_or_create_fifo = find_or_create_fifo, + fifo_push = fifo_push, + fifo_top = fifo_top, + fifomax = fifomax, +}; diff --git a/test/box/lua/identifier.lua b/test/box/lua/identifier.lua index 0cfb9e722a..21eba536b0 100644 --- a/test/box/lua/identifier.lua +++ b/test/box/lua/identifier.lua @@ -1,6 +1,6 @@ -max_len_string = string.rep('a', box.schema.NAME_MAX) +local max_len_string = string.rep('a', box.schema.NAME_MAX) -valid_testcases = { +local valid_testcases = { --[[ Symbols from various unicode groups ,, --]] "1", "_", "sd", "Ñ", "Ð", ".", "@", "#" , "â‹", "☢", @@ -13,7 +13,7 @@ valid_testcases = { "â§", "â“", max_len_string } -invalid_testcases = { +local invalid_testcases = { --[[ Invalid and non printable unicode sequences --]] --[[ 1-3 ASCII control, C0 --]] "\x01", "\x09", "\x1f", @@ -34,8 +34,7 @@ invalid_testcases = { max_len_string..'1' } -function run_test(create_func, cleanup_func) - local json = require("json") +local function run_test(create_func, cleanup_func) local bad_tests = {} for i, identifier in ipairs(valid_testcases) do local ok, res = pcall(create_func,identifier) @@ -48,7 +47,7 @@ function run_test(create_func, cleanup_func) end end for i, identifier in ipairs(invalid_testcases) do - local ok, res = pcall(create_func,identifier) + local ok = pcall(create_func,identifier) if ok then table.insert(bad_tests, "invalid_testcases: "..i) end diff --git a/test/box/lua/index_random_test.lua b/test/box/lua/index_random_test.lua index 7b5256a7cb..d8622a4dbf 100644 --- a/test/box/lua/index_random_test.lua +++ b/test/box/lua/index_random_test.lua @@ -1,4 +1,4 @@ -function index_random_test(space, index_no) +local function index_random_test(space, index_no) local COUNT = 128 -- enough to resize both sptree and mhash -- clear the space space:truncate() @@ -7,7 +7,7 @@ function index_random_test(space, index_no) -- insert values into the index for k=1,COUNT,1 do space:insert{k} end -- delete some values from the index - for i=1,COUNT/2,1 do + for _=1,COUNT/2,1 do local k = math.random(COUNT) local tuple = space:delete{k} if tuple ~= nil then COUNT = COUNT - 1 end @@ -39,3 +39,5 @@ function index_random_test(space, index_no) return true end + +return index_random_test diff --git a/test/box/lua/push.lua b/test/box/lua/push.lua index 154126f8e1..5ce0c12bc4 100644 --- a/test/box/lua/push.lua +++ b/test/box/lua/push.lua @@ -1,5 +1,4 @@ - -function push_collection(space, size, cid, ...) +local function push_collection(space, size, cid, ...) local append = { ... } local tuple = space:get{cid} if tuple == nil then @@ -14,3 +13,5 @@ function push_collection(space, size, cid, ...) end return space:replace{tuple:unpack()} end + +return push_collection diff --git a/test/box/lua/txn_proxy.lua b/test/box/lua/txn_proxy.lua index 7a4d0b865f..15b0e4add4 100644 --- a/test/box/lua/txn_proxy.lua +++ b/test/box/lua/txn_proxy.lua @@ -1,11 +1,11 @@ --- A fiber can't use multiple transactions simultaneously; +-- A fiber can't use multiple transactions simultaneously; -- i.e. [fiber] --? [transaction] in UML parlor. -- -- This module provides a simple transaction proxy facility --- to control multiple transactions at once. A proxy executes +-- to control multiple transactions at once. A proxy executes -- statements in a worker fiber in order to overcome -- "one transaction per fiber" limitation. --- +-- -- Ex: -- proxy = require('txn_proxy').new() -- proxy:begin() diff --git a/test/box/lua/utils.lua b/test/box/lua/utils.lua index 5f859fd19c..e6b3a6b57a 100644 --- a/test/box/lua/utils.lua +++ b/test/box/lua/utils.lua @@ -1,4 +1,4 @@ -function space_field_types(space_no) +local function space_field_types(space_no) local types = {}; for _, index in pairs(box.space[space_no].index) do for _,key_def in pairs(index.parts) do @@ -8,7 +8,7 @@ function space_field_types(space_no) return types; end -function iterate(space_no, index_no, f1, f2, iterator, ...) +local function iterate(space_no, index_no, f1, f2, iterator, ...) local sorted = (box.space[space_no].index[index_no].type == "TREE"); local pkeys = {}; local tkeys = {}; @@ -22,8 +22,7 @@ function iterate(space_no, index_no, f1, f2, iterator, ...) return f end end - local state, v - for state, v in box.space[space_no].index[index_no]:pairs({...}, { iterator = iterator }) do + for _, v in box.space[space_no].index[index_no]:pairs({...}, { iterator = iterator }) do local pk = get_field(v, 1); local tk = '$'; for f = f1 + 1, f2, 1 do tk = (tk..(get_field(v, f))..'$'); end; @@ -45,7 +44,7 @@ function iterate(space_no, index_no, f1, f2, iterator, ...) return values end -function arithmetic(d, count) +local function arithmetic(d, count) if not d then d = 1 end local a = 0; local i = 0; @@ -61,7 +60,7 @@ function arithmetic(d, count) end end -function table_shuffle(t) +local function table_shuffle(t) local n = #t while n >= 2 do local k = math.random(n) @@ -70,7 +69,7 @@ function table_shuffle(t) end end -function table_generate(iter) +local function table_generate(iter) local t = {}; for k in iter do table.insert(t, k); @@ -80,7 +79,7 @@ function table_generate(iter) end -- sort all rows as strings(not for tables); -function sort(tuples) +local function sort(tuples) local function compare_tables(t1, t2) return (tostring(t1) < tostring(t2)) end @@ -88,29 +87,7 @@ function sort(tuples) return tuples end; --- return string tuple -function tuple_to_string(tuple, yaml) - ans = '[' - for i = 0, #tuple - 1 do - if #i == 4 then - ans = ans..i - elseif #i == 8 then - ans = ans..i - else - ans = ans..'\''..tostring(i)..'\'' - end - if not #i == #tuple -1 then - ans = ans..', ' - end - end - ans = ans..']' - if yaml then - ans = ' - '..ans - end - return ans -end; - -function check_space(space, N) +local function check_space(space, N) local errors = {} -- @@ -195,7 +172,7 @@ function check_space(space, N) return errors end -function space_bsize(s) +local function space_bsize(s) local bsize = 0 for _, t in s:pairs() do bsize = bsize + t:bsize() @@ -204,18 +181,17 @@ function space_bsize(s) return bsize end -function create_iterator(obj, key, opts) +local function create_iterator(obj, key, opts) local iter, key, state = obj:pairs(key, opts) local res = {iter = iter, key = key, state = state} res.next = function() - local st, tp = iter.gen(key, state) + local _, tp = iter.gen(key, state) return tp end res.iterate_over = function() - local tp = nil local ret = {} local i = 0 - tp = res.next() + local tp = res.next() while tp do ret[i] = tp i = i + 1 @@ -226,18 +202,16 @@ function create_iterator(obj, key, opts) return res end -function setmap(tab) +local function setmap(tab) return setmetatable(tab, { __serialize = 'map' }) end return { - space_field_types = space_field_types; iterate = iterate; arithmetic = arithmetic; table_generate = table_generate; table_shuffle = table_shuffle; sort = sort; - tuple_to_string = tuple_to_string; check_space = check_space; space_bsize = space_bsize; create_iterator = create_iterator; diff --git a/test/box/misc.result b/test/box/misc.result index 714d5ee79f..e18a46e02a 100644 --- a/test/box/misc.result +++ b/test/box/misc.result @@ -747,46 +747,46 @@ bit.bor(1, 2) space:truncate() --- ... -dofile('fifo.lua') +fifo = require('fifo') --- ... -fifomax +fifo.fifomax --- - 5 ... -fifo_push(space, 1, 1) +fifo.fifo_push(space, 1, 1) --- - [1, 4, 5, 1, 0, 0, 0, 0] ... -fifo_push(space, 1, 2) +fifo.fifo_push(space, 1, 2) --- - [1, 5, 6, 1, 2, 0, 0, 0] ... -fifo_push(space, 1, 3) +fifo.fifo_push(space, 1, 3) --- - [1, 6, 7, 1, 2, 3, 0, 0] ... -fifo_push(space, 1, 4) +fifo.fifo_push(space, 1, 4) --- - [1, 7, 8, 1, 2, 3, 4, 0] ... -fifo_push(space, 1, 5) +fifo.fifo_push(space, 1, 5) --- - [1, 8, 4, 1, 2, 3, 4, 5] ... -fifo_push(space, 1, 6) +fifo.fifo_push(space, 1, 6) --- - [1, 4, 5, 6, 2, 3, 4, 5] ... -fifo_push(space, 1, 7) +fifo.fifo_push(space, 1, 7) --- - [1, 5, 6, 6, 7, 3, 4, 5] ... -fifo_push(space, 1, 8) +fifo.fifo_push(space, 1, 8) --- - [1, 6, 7, 6, 7, 8, 4, 5] ... -fifo_top(space, 1) +fifo.fifo_top(space, 1) --- - 8 ... @@ -794,7 +794,7 @@ space:delete{1} --- - [1, 6, 7, 6, 7, 8, 4, 5] ... -fifo_top(space, 1) +fifo.fifo_top(space, 1) --- - 0 ... diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua index 63cbe2bc5b..ce1f8744b6 100644 --- a/test/box/misc.test.lua +++ b/test/box/misc.test.lua @@ -243,19 +243,19 @@ bit.bor(1, 2) space:truncate() -dofile('fifo.lua') -fifomax -fifo_push(space, 1, 1) -fifo_push(space, 1, 2) -fifo_push(space, 1, 3) -fifo_push(space, 1, 4) -fifo_push(space, 1, 5) -fifo_push(space, 1, 6) -fifo_push(space, 1, 7) -fifo_push(space, 1, 8) -fifo_top(space, 1) +fifo = require('fifo') +fifo.fifomax +fifo.fifo_push(space, 1, 1) +fifo.fifo_push(space, 1, 2) +fifo.fifo_push(space, 1, 3) +fifo.fifo_push(space, 1, 4) +fifo.fifo_push(space, 1, 5) +fifo.fifo_push(space, 1, 6) +fifo.fifo_push(space, 1, 7) +fifo.fifo_push(space, 1, 8) +fifo.fifo_top(space, 1) space:delete{1} -fifo_top(space, 1) +fifo.fifo_top(space, 1) space:delete{1} space:drop() diff --git a/test/box/on_schema_init.lua b/test/box/on_schema_init.lua index 17cf891661..a10687a091 100644 --- a/test/box/on_schema_init.lua +++ b/test/box/on_schema_init.lua @@ -1,12 +1,12 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') -function test_before_replace_trig(old, new) +local function test_before_replace_trig(old, new) -- luacheck: no unused args -- return multiple values so that the stack fills earlier. return new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}}, new:update{{'+', 2, 1}} end -function space_on_replace_trig(old, new) +local function space_on_replace_trig(old, new) -- luacheck: no unused args if new and new[3] == 'test_on_schema_init' then box.on_commit(function() box.space.test_on_schema_init:before_replace(test_before_replace_trig) @@ -14,7 +14,7 @@ function space_on_replace_trig(old, new) end end -function on_init_trig() +local function on_init_trig() box.space._space:on_replace(space_on_replace_trig) end diff --git a/test/box/proxy.lua b/test/box/proxy.lua index 8bbd505f8c..c763e96344 100644 --- a/test/box/proxy.lua +++ b/test/box/proxy.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), diff --git a/test/box/tiny.lua b/test/box/tiny.lua index 04b523fb29..608d483665 100644 --- a/test/box/tiny.lua +++ b/test/box/tiny.lua @@ -1,5 +1,5 @@ #!/usr/bin/env tarantool -os = require('os') +local os = require('os') box.cfg{ listen = os.getenv("LISTEN"), -- GitLab