[Tarantool-patches] [PATCH v2 2/6] Fix luacheck warnings in test/

Sergey Bronnikov estetus at gmail.com
Wed Apr 8 18:43:01 MSK 2020


From: Sergey Bronnikov <sergeyb at tarantool.org>

Closes #4681
---
 test/app-tap/console.test.lua                 |  4 ---
 test/app-tap/csv.test.lua                     | 28 ++++++++--------
 test/box-py/box.lua                           |  2 +-
 test/box-tap/gc.test.lua                      |  4 +--
 test/box/box.lua                              |  2 +-
 test/box/hash_multipart.result                |  2 +-
 test/box/hash_multipart.test.lua              |  2 +-
 test/box/iproto_stress.result                 |  8 ++---
 test/box/iproto_stress.test.lua               |  4 +--
 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                    |  4 +--
 test/box/lua/cfg_test6.lua                    |  2 +-
 test/box/lua/utils.lua                        |  3 +-
 test/box/on_schema_init.lua                   |  2 +-
 test/box/proxy.lua                            |  2 +-
 test/box/tiny.lua                             |  2 +-
 test/box/tree_pk.result                       |  6 ++--
 test/box/tree_pk.test.lua                     |  6 ++--
 test/engine/tree_min_max_count.result         |  2 +-
 test/engine/tree_min_max_count.test.lua       |  2 +-
 test/replication-py/master.lua                |  2 +-
 test/replication-py/panic.lua                 |  2 +-
 test/replication/master.lua                   |  2 +-
 test/replication/replicaset_ro_mostly.result  |  2 +-
 .../replication/replicaset_ro_mostly.test.lua |  2 +-
 test/sql-tap/analyze3.test.lua                |  6 ++--
 test/sql-tap/analyze9.test.lua                | 16 ++++-----
 .../gh-4077-iproto-execute-no-bind.test.lua   |  7 ++--
 test/sql-tap/index1.test.lua                  |  1 -
 test/sql-tap/join3.test.lua                   |  2 +-
 test/sql-tap/select9.test.lua                 | 10 ++----
 test/sql-tap/tkt-fa7bf5ec.test.lua            |  6 ++--
 test/sql-tap/where2.test.lua                  |  2 +-
 test/sql/lua/sql_tokenizer.lua                |  2 +-
 test/sql/savepoints.result                    |  6 ++--
 test/sql/savepoints.test.lua                  |  6 ++--
 test/sql/triggers.result                      |  2 +-
 test/sql/triggers.test.lua                    |  2 +-
 test/vinyl/large.lua                          |  4 +--
 test/vinyl/stat.result                        | 33 ++++++++++++-------
 test/vinyl/stat.test.lua                      | 22 ++++++-------
 test/vinyl/txn_proxy.lua                      |  6 ++--
 test/vinyl/vinyl.lua                          |  2 +-
 test/wal_off/rtree_benchmark.result           |  2 +-
 test/wal_off/rtree_benchmark.test.lua         |  2 +-
 test/xlog-py/box.lua                          |  2 +-
 test/xlog/big_tx.result                       |  2 +-
 test/xlog/big_tx.test.lua                     |  2 +-
 test/xlog/checkpoint_daemon.result            |  4 +--
 test/xlog/checkpoint_daemon.test.lua          |  4 +--
 test/xlog/panic.lua                           |  2 +-
 test/xlog/panic_on_wal_error.result           |  2 +-
 test/xlog/panic_on_wal_error.test.lua         |  2 +-
 test/xlog/reader.result                       |  2 +-
 test/xlog/reader.test.lua                     |  2 +-
 test/xlog/snap_io_rate.test.lua               |  2 +-
 test/xlog/transaction.result                  | 18 +++++-----
 test/xlog/transaction.test.lua                | 18 +++++-----
 test/xlog/xlog.lua                            |  2 +-
 64 files changed, 157 insertions(+), 155 deletions(-)

diff --git a/test/app-tap/console.test.lua b/test/app-tap/console.test.lua
index da5c1e71e..737450387 100755
--- a/test/app-tap/console.test.lua
+++ b/test/app-tap/console.test.lua
@@ -5,7 +5,6 @@ local console = require('console')
 local socket = require('socket')
 local yaml = require('yaml')
 local fiber = require('fiber')
-local ffi = require('ffi')
 local log = require('log')
 local fio = require('fio')
 
@@ -59,12 +58,9 @@ test:is(#client:read(EOL) > 0, true, "_G")
 client:write("require('fiber').id()\n")
 local fid1 = yaml.decode(client:read(EOL))[1]
 local state = fiber.find(fid1).storage.console
-local server_info = state.client:peer()
 local client_info = state.client:name()
 test:is(client_info.host, client_info.host, "state.socker:peer().host")
 test:is(client_info.port, client_info.port, "state.socker:peer().port")
-server_info = nil
-client_info = nil
 
 -- Check console.delimiter()
 client:write("require('console').delimiter(';')\n")
diff --git a/test/app-tap/csv.test.lua b/test/app-tap/csv.test.lua
index a7f17b1ea..689db7997 100755
--- a/test/app-tap/csv.test.lua
+++ b/test/app-tap/csv.test.lua
@@ -2,9 +2,9 @@
 
 local function table2str(t)
     local res = ""
-    for k, line in pairs(t) do
+    for _, line in pairs(t) do
         local s = ""
-        for k2, field in pairs(line) do
+        for _, field in pairs(line) do
             s = s .. '|' .. field .. '|\t'
         end
         res = res .. s .. '\n'
@@ -12,9 +12,9 @@ local function table2str(t)
     return res
 end
 
-local function myread(self, bytes) 
+local function myread(self, bytes)
     self.i = self.i + bytes
-    return self.v:sub(self.i - bytes + 1, self.i) 
+    return self.v:sub(self.i - bytes + 1, self.i)
 end
 local csv = require('csv')
 local fio = require('fio')
@@ -27,10 +27,10 @@ local test4_ans = '|123|\t|5|\t|92|\t|0|\t|0|\t\n|1|\t|12  34|\t|56|\t' ..
 local test5_ans = "|1|\t\n|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n" ..
                   "|none|\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f" ..
                   "3|\t|0|\t\n|local res = internal.pwrite(self.fh|\t|dat" ..
-                  "a|\t|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio." .. 
+                  "a|\t|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio." ..
                   "c.flag[ flag ])|\t\n||\t||\t||\t\n"
 local test6_ans = "|23|\t|456|\t|abcac|\t|'multiword field 4'|\t\n|none|" ..
-                  "\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f3|\t|" .. 
+                  "\t|none|\t|0|\t\n||\t||\t||\t\n|aba|\t|adda|\t|f3|\t|" ..
                   "0|\t\n|local res = internal.pwrite(self.fh|\t|data|\t" ..
                   "|len|\t|offset)|\t\n|iflag = bit.bor(iflag|\t|fio.c.f" ..
                   "lag[ flag ])|\t\n||\t||\t||\t\n"
@@ -62,7 +62,7 @@ local f = fio.open(file1, { 'O_WRONLY', 'O_TRUNC', 'O_CREAT' }, tonumber('0777',
 f:write("123 , 5  ,       92    , 0, 0\n" ..
         "1, 12  34, 56, \"quote , \", 66\nok")
 f:close()
-f = fio.open(file1, {'O_RDONLY'}) 
+f = fio.open(file1, {'O_RDONLY'})
 test:is(table2str(csv.load(f, {chunk_size = 10})), test4_ans, "fio test1")
 f:close()
 
@@ -77,20 +77,20 @@ f:write("1\n23,456,abcac,\'multiword field 4\'\n" ..
         ",,"
 )
 f:close()
-f = fio.open(file2, {'O_RDONLY'}) 
+f = fio.open(file2, {'O_RDONLY'})
 --symbol by symbol reading
-test:is(table2str(csv.load(f, {chunk_size = 1})), test5_ans, "fio test2") 
+test:is(table2str(csv.load(f, {chunk_size = 1})), test5_ans, "fio test2")
 f:close()
 
-f = fio.open(file2, {'O_RDONLY'}) 
+f = fio.open(file2, {'O_RDONLY'})
 opts = {chunk_size = 7, skip_head_lines = 1}
 --7 symbols per chunk
-test:is(table2str(csv.load(f, opts)), test6_ans, "fio test3") 
+test:is(table2str(csv.load(f, opts)), test6_ans, "fio test3")
 f:close()
 
 t = {
-    {'quote" d', ',and, comma', 'both " of " t,h,e,m'}, 
-    {'"""', ',","'}, 
+    {'quote" d', ',and, comma', 'both " of " t,h,e,m'},
+    {'"""', ',","'},
     {'mul\nti\nli\r\nne\n\n', 'field'},
     {""},
     {'"'},
@@ -100,7 +100,7 @@ t = {
 f = require("fio").open(file3, { "O_WRONLY", "O_TRUNC" , "O_CREAT"}, 0x1FF)
 csv.dump(t, {}, f)
 f:close()
-f = fio.open(file3, {'O_RDONLY'}) 
+f = fio.open(file3, {'O_RDONLY'})
 t2 = csv.load(f, {chunk_size = 5})
 f:close()
 
diff --git a/test/box-py/box.lua b/test/box-py/box.lua
index e9403774c..35a087de9 100644
--- a/test/box-py/box.lua
+++ b/test/box-py/box.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-tap/gc.test.lua b/test/box-tap/gc.test.lua
index f88752e71..f0155779c 100755
--- a/test/box-tap/gc.test.lua
+++ b/test/box-tap/gc.test.lua
@@ -4,7 +4,7 @@ local fiber = require('fiber')
 
 box.cfg{}
 
-local debug = type(box.error.injection) == "table" 
+local debug = type(box.error.injection) == "table"
 
 -- check box.info.gc() is false if snapshot is not in progress
 local test = tap.test('box.info.gc')
@@ -19,7 +19,7 @@ test:is(gc.checkpoint_is_in_progress, false, "checkpoint is not in progress")
 if debug then
     box.error.injection.set("ERRINJ_SNAP_COMMIT_DELAY", true)
     local snapshot_f  = function()
-       box.snapshot() 
+       box.snapshot()
     end
     fiber.create(snapshot_f)
     local gc = box.info.gc()
diff --git a/test/box/box.lua b/test/box/box.lua
index 6fad07015..2cf399f96 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')
 
diff --git a/test/box/hash_multipart.result b/test/box/hash_multipart.result
index e94313b62..e6915652f 100644
--- a/test/box/hash_multipart.result
+++ b/test/box/hash_multipart.result
@@ -62,7 +62,7 @@ test_run:cmd("setopt delimiter ';'")
 function select_all()
     local result = {}
     local tuple, v
-    for tuple, v in hash:pairs() do
+    for _, v in hash:pairs() do
         table.insert(result, v)
     end
     return result
diff --git a/test/box/hash_multipart.test.lua b/test/box/hash_multipart.test.lua
index c0a871bee..c572d13b6 100644
--- a/test/box/hash_multipart.test.lua
+++ b/test/box/hash_multipart.test.lua
@@ -24,7 +24,7 @@ test_run:cmd("setopt delimiter ';'")
 function select_all()
     local result = {}
     local tuple, v
-    for tuple, v in hash:pairs() do
+    for _, v in hash:pairs() do
         table.insert(result, v)
     end
     return result
diff --git a/test/box/iproto_stress.result b/test/box/iproto_stress.result
index 7149d6c52..3b5b0a031 100644
--- a/test/box/iproto_stress.result
+++ b/test/box/iproto_stress.result
@@ -76,13 +76,13 @@ test_run:wait_cond(function() return n_workers == 0 end, 60)
 ---
 - true
 ...
-n_workers -- 0
+assert(n_workers == 0)
 ---
-- 0
+- true
 ...
-n_errors -- 0
+assert(n_errors == 0)
 ---
-- 0
+- true
 ...
 box.schema.user.revoke('guest', 'read,write,execute', 'universe')
 ---
diff --git a/test/box/iproto_stress.test.lua b/test/box/iproto_stress.test.lua
index 1e1a6578b..68d1f56fd 100644
--- a/test/box/iproto_stress.test.lua
+++ b/test/box/iproto_stress.test.lua
@@ -42,8 +42,8 @@ fiber.sleep(0.1)
 box.error.injection.set("ERRINJ_WAL_DELAY", false)
 
 test_run:wait_cond(function() return n_workers == 0 end, 60)
-n_workers -- 0
-n_errors -- 0
+assert(n_workers == 0)
+assert(n_errors == 0)
 
 box.schema.user.revoke('guest', 'read,write,execute', 'universe')
 s:drop()
diff --git a/test/box/lua/cfg_bad_vinyl_dir.lua b/test/box/lua/cfg_bad_vinyl_dir.lua
index 8e1a98dc8..82746b99a 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 f2d32ef7d..860cb14a8 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 60b7aff9a..aa026ed42 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 2397f9c19..536661698 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 6a6e544b6..4978900fb 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 82dab8757..21a38f95c 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 e3eb87392..8b6f9b31c 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"),
@@ -7,4 +7,4 @@ box.cfg{
 }
 
 require('console').listen(os.getenv('ADMIN'))
-box.schema.user.grant('guest', 'read,write,execute', 'universe')
\ No newline at end of file
+box.schema.user.grant('guest', 'read,write,execute', 'universe')
diff --git a/test/box/lua/cfg_test6.lua b/test/box/lua/cfg_test6.lua
index efcfc6f3e..0a5859bc5 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/utils.lua b/test/box/lua/utils.lua
index 5f859fd19..058c4a471 100644
--- a/test/box/lua/utils.lua
+++ b/test/box/lua/utils.lua
@@ -212,10 +212,9 @@ function create_iterator(obj, key, opts)
         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
diff --git a/test/box/on_schema_init.lua b/test/box/on_schema_init.lua
index 17cf89166..f74d6d7fe 100644
--- a/test/box/on_schema_init.lua
+++ b/test/box/on_schema_init.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 function test_before_replace_trig(old, new)
     -- return multiple values so that the stack fills earlier.
diff --git a/test/box/proxy.lua b/test/box/proxy.lua
index 8bbd505f8..c763e9634 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 04b523fb2..608d48366 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"),
diff --git a/test/box/tree_pk.result b/test/box/tree_pk.result
index df3c78bed..4489d8cd9 100644
--- a/test/box/tree_pk.result
+++ b/test/box/tree_pk.result
@@ -27,7 +27,7 @@ box.snapshot()
 ---
 - ok
 ...
-i0:bsize() > bsize
+assert(i0:bsize() > bsize)
 ---
 - true
 ...
@@ -153,8 +153,8 @@ test_run:cmd("setopt delimiter ';'")
 ...
 function crossjoin(space0, space1, limit)
     local result = {}
-    for state, v0 in space0:pairs() do
-        for state, v1 in space1:pairs() do
+    for _, v0 in space0:pairs() do
+        for _, v1 in space1:pairs() do
             if limit <= 0 then
                 return result
             end
diff --git a/test/box/tree_pk.test.lua b/test/box/tree_pk.test.lua
index 1190ab424..bc3784a98 100644
--- a/test/box/tree_pk.test.lua
+++ b/test/box/tree_pk.test.lua
@@ -11,7 +11,7 @@ box.snapshot()
 s0:insert{2, 'tuple 2'}
 box.snapshot()
 
-i0:bsize() > bsize
+assert(i0:bsize() > bsize)
 
 s0:insert{3, 'tuple 3'}
 s0.index['primary']:get{1}
@@ -58,8 +58,8 @@ test_run = env.new()
 test_run:cmd("setopt delimiter ';'")
 function crossjoin(space0, space1, limit)
     local result = {}
-    for state, v0 in space0:pairs() do
-        for state, v1 in space1:pairs() do
+    for _, v0 in space0:pairs() do
+        for _, v1 in space1:pairs() do
             if limit <= 0 then
                 return result
             end
diff --git a/test/engine/tree_min_max_count.result b/test/engine/tree_min_max_count.result
index f55732aa6..9f1595a20 100644
--- a/test/engine/tree_min_max_count.result
+++ b/test/engine/tree_min_max_count.result
@@ -1189,7 +1189,7 @@ space6:drop()
 ---
 ...
 -- min max count after many inserts
-string = require('string')
+local string = require('string')
 ---
 ...
 space7 = box.schema.space.create('space7', { engine = engine })
diff --git a/test/engine/tree_min_max_count.test.lua b/test/engine/tree_min_max_count.test.lua
index 0633c56b3..19b5fe92d 100644
--- a/test/engine/tree_min_max_count.test.lua
+++ b/test/engine/tree_min_max_count.test.lua
@@ -337,7 +337,7 @@ space6:drop()
 
 -- min max count after many inserts
 
-string = require('string')
+local string = require('string')
 
 space7 = box.schema.space.create('space7', { engine = engine })
 index7 = space7:create_index('primary', { type = 'tree', parts = {1, 'scalar'} })
diff --git a/test/replication-py/master.lua b/test/replication-py/master.lua
index e924b5495..b43bafd54 100644
--- a/test/replication-py/master.lua
+++ b/test/replication-py/master.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 box.cfg({
     listen              = os.getenv("LISTEN"),
     memtx_memory        = 107374182,
diff --git a/test/replication-py/panic.lua b/test/replication-py/panic.lua
index 75a738cbb..e72d11419 100644
--- a/test/replication-py/panic.lua
+++ b/test/replication-py/panic.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 box.cfg({
     listen              = os.getenv("LISTEN"),
     memtx_memory        = 107374182,
diff --git a/test/replication/master.lua b/test/replication/master.lua
index e924b5495..b43bafd54 100644
--- a/test/replication/master.lua
+++ b/test/replication/master.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 box.cfg({
     listen              = os.getenv("LISTEN"),
     memtx_memory        = 107374182,
diff --git a/test/replication/replicaset_ro_mostly.result b/test/replication/replicaset_ro_mostly.result
index a471779d3..e509e0da0 100644
--- a/test/replication/replicaset_ro_mostly.result
+++ b/test/replication/replicaset_ro_mostly.result
@@ -35,7 +35,7 @@ test_run:cmd("setopt delimiter ';'")
 - true
 ...
 function create_cluster_uuid(servers, uuids)
-    for i, name in ipairs(servers) do
+    for _, name in ipairs(servers) do
         test_run:cmd(create_cluster_cmd1:format(name, name))
     end
     for i, name in ipairs(servers) do
diff --git a/test/replication/replicaset_ro_mostly.test.lua b/test/replication/replicaset_ro_mostly.test.lua
index 19cd1fe4a..e06e29c8e 100644
--- a/test/replication/replicaset_ro_mostly.test.lua
+++ b/test/replication/replicaset_ro_mostly.test.lua
@@ -16,7 +16,7 @@ create_cluster_cmd2 = 'start server %s with args="%s", wait_load=False, wait=Fal
 
 test_run:cmd("setopt delimiter ';'")
 function create_cluster_uuid(servers, uuids)
-    for i, name in ipairs(servers) do
+    for _, name in ipairs(servers) do
         test_run:cmd(create_cluster_cmd1:format(name, name))
     end
     for i, name in ipairs(servers) do
diff --git a/test/sql-tap/analyze3.test.lua b/test/sql-tap/analyze3.test.lua
index dcbea1da5..5c9c28601 100755
--- a/test/sql-tap/analyze3.test.lua
+++ b/test/sql-tap/analyze3.test.lua
@@ -23,15 +23,15 @@ testprefix = "analyze3"
 ------------------------------------------------------------------------
 -- Test Organization:
 --
--- analyze3-1.*: Test that the values of bound parameters are considered 
+-- analyze3-1.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use range constraints.
 --
--- analyze3-2.*: Test that the values of bound parameters are considered 
+-- analyze3-2.*: Test that the values of bound parameters are considered
 --               in the same way as constants when planning queries that
 --               use LIKE expressions in the WHERE clause.
 --
--- analyze3-3.*: Test that binding to a variable does not invalidate the 
+-- analyze3-3.*: Test that binding to a variable does not invalidate the
 --               query plan when there is no way in which replanning the
 --               query may produce a superior outcome.
 --
diff --git a/test/sql-tap/analyze9.test.lua b/test/sql-tap/analyze9.test.lua
index 02eb49f69..7412ba5fe 100755
--- a/test/sql-tap/analyze9.test.lua
+++ b/test/sql-tap/analyze9.test.lua
@@ -609,7 +609,7 @@ test:do_execsql_test(
 test:do_test(
     "10.1.2",
     function()
-        local a = 0
+        local a
         for i = 1, 100 do
             if i > 90 then
                 a = i
@@ -657,7 +657,7 @@ test:do_execsql_test(
 test:do_test(
     "10.2.2",
     function()
-        local a = 0
+        local a
         for i = 1, 100 do
             if i > 90 then
                 a = i
@@ -711,7 +711,7 @@ test:do_execsql_test(
 test:do_test(
     11.1,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -762,7 +762,7 @@ test:do_execsql_test(
 test:do_test(
     11.5,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -823,7 +823,7 @@ test:do_execsql_test(
 test:do_test(
     12.1,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -874,7 +874,7 @@ test:do_execsql_test(
 test:do_test(
     12.5,
     function()
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 10 == 0 then 
                 a = "\"ABC\""
@@ -931,7 +931,7 @@ test:do_test(
         test:execsql("CREATE TABLE t1(id INTEGER PRIMARY KEY AUTOINCREMENT, a TEXT, b INT, c INT, d INT);")
         test:execsql("CREATE INDEX i1 ON t1(a);")
         test:execsql("CREATE INDEX i2 ON t1(b, c);")
-        local a = 0
+        local a
         for i = 0, 100 do
             if i % 2 == 1 then
                 a = "\"abc\""
@@ -1161,7 +1161,7 @@ test:do_test(
             INSERT INTO t1 SELECT null, 2*a,2*b,2*c,d FROM t1;
             INSERT INTO t1 SELECT null, 2*a,2*b,2*c,d FROM t1;
         ]])
-        local b = 0
+        local b
         for i = 0, 31 do
             if (i < 8) then
                 b = 0
diff --git a/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
index d4b597e35..2f71a68ea 100755
--- a/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
+++ b/test/sql-tap/gh-4077-iproto-execute-no-bind.test.lua
@@ -41,10 +41,11 @@ local size = msgpack.encode(header:len() + body:len())
 sock:write(size .. header .. body)
 
 -- Read response.
-local size = msgpack.decode(sock:read(5))
+size = msgpack.decode(sock:read(5))
 local header_body = sock:read(size)
-local header, header_len = msgpack.decode(header_body)
-local body = msgpack.decode(header_body:sub(header_len))
+local header_len
+header, header_len = msgpack.decode(header_body)
+body = msgpack.decode(header_body:sub(header_len))
 sock:close()
 
 -- Verify response.
diff --git a/test/sql-tap/index1.test.lua b/test/sql-tap/index1.test.lua
index e173e685c..4c4a37ca7 100755
--- a/test/sql-tap/index1.test.lua
+++ b/test/sql-tap/index1.test.lua
@@ -106,7 +106,6 @@ test:do_test(
 test:do_test(
     "index-2.2",
     function()
-        local msg
         local v , msg= pcall(function()
             test:execsql("CREATE INDEX index1 ON test1(f1, f2, f4, f3)")
             end)
diff --git a/test/sql-tap/join3.test.lua b/test/sql-tap/join3.test.lua
index 876b3121a..030fbaba3 100755
--- a/test/sql-tap/join3.test.lua
+++ b/test/sql-tap/join3.test.lua
@@ -49,7 +49,7 @@ for N=1, bitmask_size do
 end
 -- Joins with a comparison
 --
-local result = {}
+result = {}
 --for _ in X(0, "X!for", [=[["set N 1","$N<=$bitmask_size","incr N"]]=]) do
 for N=1, bitmask_size do
     table.insert(result,N)
diff --git a/test/sql-tap/select9.test.lua b/test/sql-tap/select9.test.lua
index 1ae16a658..bcc270593 100755
--- a/test/sql-tap/select9.test.lua
+++ b/test/sql-tap/select9.test.lua
@@ -60,10 +60,8 @@ function subrange(t, first, last)
 end
 
 local function test_compound_select(testname, sql, result)
-    local nCol = 1
     local A = box.execute(sql) --test.box(sql)
-    nCol = #A.metadata
-    A = A.rows
+    local nCol = #A.metadata
     local nRow = #result / nCol
     local compound_sql = sql
     test:do_execsql_test(
@@ -274,10 +272,8 @@ test:do_execsql_test(
         -- </select9-2.0>
     })
 
-local t1_space_id = ""
-local t2_space_id = ""
-t1_space_id = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
-t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
+local t1_space_id = test:execsql([[SELECT * from "_space" where "name"='T1']])["id"]
+local t2_space_id = test:execsql([[SELECT * from "_space" where "name"='T2']])["id"]
 --X(276, "X!cmd", [=[["db","eval","SELECT * from _space where name='t2'","data","\n  set t2_space_id $data(id)\n"]]=])
 --local function reverse(lhs, rhs)
 --    return X(283, "X!cmd", [=[["string","compare",["rhs"],["lhs"]]]=])
diff --git a/test/sql-tap/tkt-fa7bf5ec.test.lua b/test/sql-tap/tkt-fa7bf5ec.test.lua
index 7152e028c..25d44c9d3 100755
--- a/test/sql-tap/tkt-fa7bf5ec.test.lua
+++ b/test/sql-tap/tkt-fa7bf5ec.test.lua
@@ -20,9 +20,9 @@ test:plan(1)
 -- The problem described by this ticket was that the sqlExprCompare()
 -- function was saying that expressions (x='a') and (x='A') were identical
 -- because it was using sqlStrICmp() instead of strcmp() to compare string
--- literals.  That was causing the query optimizer for aggregate queries to 
--- believe that both count() operations were identical, and thus only 
--- computing the first count() and making a copy of the result for the 
+-- literals.  That was causing the query optimizer for aggregate queries to
+-- believe that both count() operations were identical, and thus only
+-- computing the first count() and making a copy of the result for the
 -- second count().
 --
 -- ["set","testdir",[["file","dirname",["argv0"]]]]
diff --git a/test/sql-tap/where2.test.lua b/test/sql-tap/where2.test.lua
index f267be8e6..f2db6fcee 100755
--- a/test/sql-tap/where2.test.lua
+++ b/test/sql-tap/where2.test.lua
@@ -115,7 +115,7 @@ local function queryplan(sql)
                 table.insert(data, tab)
                 table.insert(data, idx)
             else
-                as, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
+                _, tab = string.match(v, "TABLE (%w+ AS) (%w+)")
                 if tab == nil  then
                     tab = string.match(v, "TABLE (%w+)")
                 end
diff --git a/test/sql/lua/sql_tokenizer.lua b/test/sql/lua/sql_tokenizer.lua
index 9922d792d..ffe4fb4e8 100644
--- a/test/sql/lua/sql_tokenizer.lua
+++ b/test/sql/lua/sql_tokenizer.lua
@@ -134,7 +134,7 @@ end
 -- @retval Token type. If the rest of the SQL request consists of
 --         spaces and comments, then return TK_EMPTY.
 local function get_next_token(context)
-    local c = ''
+    local c
     repeat
         local i = context.offset
         c = context.sql:sub(i, i)
diff --git a/test/sql/savepoints.result b/test/sql/savepoints.result
index 509c33e59..b0915f398 100644
--- a/test/sql/savepoints.result
+++ b/test/sql/savepoints.result
@@ -102,12 +102,12 @@ collision_sv_2 = function()
     box.begin()
     box.execute('SAVEPOINT t1;')
     box.execute('SAVEPOINT t2;')
-    local _,err = box.execute('SAVEPOINT t1;')
+    local _, err = box.execute('SAVEPOINT t1;')
     assert(err == nil)
     box.execute('RELEASE SAVEPOINT t1;')
-    local _,err = box.execute('RELEASE SAVEPOINT t1;')
+    _, err = box.execute('RELEASE SAVEPOINT t1;')
     assert(err ~= nil)
-    local _, err = box.execute('ROLLBACK TO t2;')
+    _, err = box.execute('ROLLBACK TO t2;')
     assert(err == nil)
 end;
 ---
diff --git a/test/sql/savepoints.test.lua b/test/sql/savepoints.test.lua
index f1b15c748..eb7bea37d 100644
--- a/test/sql/savepoints.test.lua
+++ b/test/sql/savepoints.test.lua
@@ -65,12 +65,12 @@ collision_sv_2 = function()
     box.begin()
     box.execute('SAVEPOINT t1;')
     box.execute('SAVEPOINT t2;')
-    local _,err = box.execute('SAVEPOINT t1;')
+    local _, err = box.execute('SAVEPOINT t1;')
     assert(err == nil)
     box.execute('RELEASE SAVEPOINT t1;')
-    local _,err = box.execute('RELEASE SAVEPOINT t1;')
+    _, err = box.execute('RELEASE SAVEPOINT t1;')
     assert(err ~= nil)
-    local _, err = box.execute('ROLLBACK TO t2;')
+    _, err = box.execute('ROLLBACK TO t2;')
     assert(err == nil)
 end;
 collision_sv_2();
diff --git a/test/sql/triggers.result b/test/sql/triggers.result
index ceecb8ef2..e70d72947 100644
--- a/test/sql/triggers.result
+++ b/test/sql/triggers.result
@@ -11,7 +11,7 @@ _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
 ...
 -- Get invariant part of the tuple; name and opts don't change.
- function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
+ function immutable_part(data) local r = {} for _, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
 ---
 ...
 --
diff --git a/test/sql/triggers.test.lua b/test/sql/triggers.test.lua
index f5c8a3961..bc694ebc4 100644
--- a/test/sql/triggers.test.lua
+++ b/test/sql/triggers.test.lua
@@ -4,7 +4,7 @@ engine = test_run:get_cfg('engine')
 _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- Get invariant part of the tuple; name and opts don't change.
- function immutable_part(data) local r = {} for i, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
+ function immutable_part(data) local r = {} for _, l in pairs(data) do table.insert(r, {l.name, l.opts}) end return r end
 
 --
 -- gh-3273: Move Triggers to server
diff --git a/test/vinyl/large.lua b/test/vinyl/large.lua
index e10e94c1a..a11642ff0 100644
--- a/test/vinyl/large.lua
+++ b/test/vinyl/large.lua
@@ -1,5 +1,5 @@
-fiber = require('fiber')
-digest = require('digest')
+local fiber = require('fiber')
+local digest = require('digest')
 
 local PAGE_SIZE = 1024
 local RANGE_SIZE = 64 * PAGE_SIZE
diff --git a/test/vinyl/stat.result b/test/vinyl/stat.result
index d35def13d..914c2ede4 100644
--- a/test/vinyl/stat.result
+++ b/test/vinyl/stat.result
@@ -1792,13 +1792,15 @@ dump(1, 100) -- split + compaction
 wait_compaction(3)
 ---
 ...
-i:stat().range_count -- 2
+assert(i:stat().range_count,  2)
 ---
 - 2
+- 2
 ...
-i:stat().dumps_per_compaction -- 1
+assert(i:stat().dumps_per_compaction, 1)
 ---
 - 1
+- 1
 ...
 dump(1, 10)
 ---
@@ -1809,9 +1811,10 @@ dump(1, 40) -- compaction in range 1
 wait_compaction(4)
 ---
 ...
-i:stat().dumps_per_compaction -- 1
+assert(i:stat().dumps_per_compaction, 1)
 ---
 - 1
+- 1
 ...
 dump(90, 100)
 ---
@@ -1822,9 +1825,10 @@ dump(60, 100) -- compaction in range 2
 wait_compaction(5)
 ---
 ...
-i:stat().dumps_per_compaction -- 2
+assert(i:stat().dumps_per_compaction, 2)
 ---
 - 2
+- 2
 ...
 -- Forcing compaction manually doesn't affect dumps_per_compaction.
 dump(40, 60)
@@ -1836,9 +1840,10 @@ i:compact()
 wait_compaction(7)
 ---
 ...
-i:stat().dumps_per_compaction -- 2
+assert(i:stat().dumps_per_compaction, 2)
 ---
 - 2
+- 2
 ...
 test_run:cmd('restart server test')
 fiber = require('fiber')
@@ -1853,9 +1858,10 @@ s = box.space.test
 i = s.index.primary
 ---
 ...
-i:stat().dumps_per_compaction -- 2
+assert(i:stat().dumps_per_compaction, 2)
 ---
 - 2
+- 2
 ...
 for i = 1, 100 do s:replace{i, digest.urandom(100)} end
 ---
@@ -1868,9 +1874,10 @@ test_run:wait_cond(function() return i:stat().disk.compaction.count == 2 end, 10
 ---
 - true
 ...
-i:stat().dumps_per_compaction -- 1
+assert(i:stat().dumps_per_compaction, 1)
 ---
 - 1
+- 1
 ...
 s:drop()
 ---
@@ -1892,9 +1899,10 @@ s:insert{1}
 ---
 - [1]
 ...
-i:stat().txw.rows -- 1
+assert(i:stat().txw.rows, 1)
 ---
 - 1
+- 1
 ...
 sv = box.savepoint()
 ---
@@ -1903,23 +1911,26 @@ s:insert{2}
 ---
 - [2]
 ...
-i:stat().txw.rows -- 2
+assert(i:stat().txw.rows, 2)
 ---
 - 2
+- 2
 ...
 box.rollback_to_savepoint(sv)
 ---
 ...
-i:stat().txw.rows -- 1
+assert(i:stat().txw.rows, 1)
 ---
 - 1
+- 1
 ...
 box.commit()
 ---
 ...
-i:stat().txw.rows -- 0
+assert(i:stat().txw.rows, 0)
 ---
 - 0
+- 0
 ...
 s:drop()
 ---
diff --git a/test/vinyl/stat.test.lua b/test/vinyl/stat.test.lua
index a8657ccf4..7ff2d95f3 100644
--- a/test/vinyl/stat.test.lua
+++ b/test/vinyl/stat.test.lua
@@ -555,24 +555,24 @@ i:stat().dumps_per_compaction -- 1
 dump(1, 100) -- compaction
 dump(1, 100) -- split + compaction
 wait_compaction(3)
-i:stat().range_count -- 2
-i:stat().dumps_per_compaction -- 1
+assert(i:stat().range_count,  2)
+assert(i:stat().dumps_per_compaction, 1)
 
 dump(1, 10)
 dump(1, 40) -- compaction in range 1
 wait_compaction(4)
-i:stat().dumps_per_compaction -- 1
+assert(i:stat().dumps_per_compaction, 1)
 
 dump(90, 100)
 dump(60, 100) -- compaction in range 2
 wait_compaction(5)
-i:stat().dumps_per_compaction -- 2
+assert(i:stat().dumps_per_compaction, 2)
 
 -- Forcing compaction manually doesn't affect dumps_per_compaction.
 dump(40, 60)
 i:compact()
 wait_compaction(7)
-i:stat().dumps_per_compaction -- 2
+assert(i:stat().dumps_per_compaction, 2)
 
 test_run:cmd('restart server test')
 
@@ -582,12 +582,12 @@ digest = require('digest')
 s = box.space.test
 i = s.index.primary
 
-i:stat().dumps_per_compaction -- 2
+assert(i:stat().dumps_per_compaction, 2)
 for i = 1, 100 do s:replace{i, digest.urandom(100)} end
 box.snapshot()
 test_run:wait_cond(function() return i:stat().disk.compaction.count == 2 end, 10)
 
-i:stat().dumps_per_compaction -- 1
+assert(i:stat().dumps_per_compaction, 1)
 
 s:drop()
 
@@ -599,14 +599,14 @@ s = box.schema.space.create('test', {engine = 'vinyl'})
 i = s:create_index('pk')
 box.begin()
 s:insert{1}
-i:stat().txw.rows -- 1
+assert(i:stat().txw.rows, 1)
 sv = box.savepoint()
 s:insert{2}
-i:stat().txw.rows -- 2
+assert(i:stat().txw.rows, 2)
 box.rollback_to_savepoint(sv)
-i:stat().txw.rows -- 1
+assert(i:stat().txw.rows, 1)
 box.commit()
-i:stat().txw.rows -- 0
+assert(i:stat().txw.rows, 0)
 s:drop()
 
 test_run:cmd('switch default')
diff --git a/test/vinyl/txn_proxy.lua b/test/vinyl/txn_proxy.lua
index 7a4d0b865..15b0e4add 100644
--- a/test/vinyl/txn_proxy.lua
+++ b/test/vinyl/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/vinyl/vinyl.lua b/test/vinyl/vinyl.lua
index 31307f4bc..02b5c010b 100644
--- a/test/vinyl/vinyl.lua
+++ b/test/vinyl/vinyl.lua
@@ -15,7 +15,7 @@ box.cfg {
     vinyl_max_tuple_size = 1024 * 1024 * 6,
 }
 
-function box_info_sort(data)
+local function box_info_sort(data)
     if type(data)~='table' then
         return data
     end
diff --git a/test/wal_off/rtree_benchmark.result b/test/wal_off/rtree_benchmark.result
index 8e01c9f2a..8deefca82 100644
--- a/test/wal_off/rtree_benchmark.result
+++ b/test/wal_off/rtree_benchmark.result
@@ -163,7 +163,7 @@ for i = 1, 0 do
    for j = 1, dimension do
       table.insert(rect, 180*math.random())
    end
-   for k,v in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
+   for _,_ in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
       n = n + 1
    end
 end;
diff --git a/test/wal_off/rtree_benchmark.test.lua b/test/wal_off/rtree_benchmark.test.lua
index 6fae977c9..6bdc0a758 100644
--- a/test/wal_off/rtree_benchmark.test.lua
+++ b/test/wal_off/rtree_benchmark.test.lua
@@ -96,7 +96,7 @@ for i = 1, 0 do
    for j = 1, dimension do
       table.insert(rect, 180*math.random())
    end
-   for k,v in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
+   for _,_ in pairs(s.index.spatial:select(rect, {limit = n_neighbors, iterator = 'NEIGHBOR'})) do
       n = n + 1
    end
 end;
diff --git a/test/xlog-py/box.lua b/test/xlog-py/box.lua
index c87f7b94b..8b9e9434f 100644
--- a/test/xlog-py/box.lua
+++ b/test/xlog-py/box.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/xlog/big_tx.result b/test/xlog/big_tx.result
index 48085031b..837a4b478 100644
--- a/test/xlog/big_tx.result
+++ b/test/xlog/big_tx.result
@@ -11,7 +11,7 @@ t = box.space.big_tx:insert({1, digest.urandom(512 * 1024)})
 ---
 ...
 env:cmd('restart server default')
-#box.space.big_tx:select()
+assert(#box.space.big_tx:select())
 ---
 - 1
 ...
diff --git a/test/xlog/big_tx.test.lua b/test/xlog/big_tx.test.lua
index b90a14a82..09624ed53 100644
--- a/test/xlog/big_tx.test.lua
+++ b/test/xlog/big_tx.test.lua
@@ -5,7 +5,7 @@ _ = box.schema.space.create('big_tx'):create_index('pk')
 t = box.space.big_tx:insert({1, digest.urandom(512 * 1024)})
 env:cmd('restart server default')
 
-#box.space.big_tx:select()
+assert(#box.space.big_tx:select())
 
 box.space.big_tx:drop()
 
diff --git a/test/xlog/checkpoint_daemon.result b/test/xlog/checkpoint_daemon.result
index 5be7124fe..dc806ea1d 100644
--- a/test/xlog/checkpoint_daemon.result
+++ b/test/xlog/checkpoint_daemon.result
@@ -118,11 +118,11 @@ wait_snapshot_gc(WAIT_COND_TIMEOUT)
 ---
 - true
 ...
-#snaps == 2 or snaps
+assert(#snaps == 2 or snaps)
 ---
 - true
 ...
-#xlogs > 0
+assert(#xlogs > 0)
 ---
 - true
 ...
diff --git a/test/xlog/checkpoint_daemon.test.lua b/test/xlog/checkpoint_daemon.test.lua
index d3138f356..0ef3d89da 100644
--- a/test/xlog/checkpoint_daemon.test.lua
+++ b/test/xlog/checkpoint_daemon.test.lua
@@ -70,8 +70,8 @@ for i = 1, row_count_per_wal + 10 do space:insert { no } no = no + 1 end
 wait_snapshot(WAIT_COND_TIMEOUT)
 wait_snapshot_gc(WAIT_COND_TIMEOUT)
 
-#snaps == 2 or snaps
-#xlogs > 0
+assert(#snaps == 2 or snaps)
+assert(#xlogs > 0)
 
 -- gh-2780: check that a last snapshot mtime will be changed at
 -- least two times.
diff --git a/test/xlog/panic.lua b/test/xlog/panic.lua
index 2d4eb8d2e..0fa855421 100644
--- a/test/xlog/panic.lua
+++ b/test/xlog/panic.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/xlog/panic_on_wal_error.result b/test/xlog/panic_on_wal_error.result
index 22f14f912..7bdd5119a 100644
--- a/test/xlog/panic_on_wal_error.result
+++ b/test/xlog/panic_on_wal_error.result
@@ -19,7 +19,7 @@ _ = box.space.test:create_index('pk')
 -- reopen xlog
 --
 test_run:cmd("restart server default")
-box.space.test ~= nil
+assert(box.space.test ~= nil)
 ---
 - true
 ...
diff --git a/test/xlog/panic_on_wal_error.test.lua b/test/xlog/panic_on_wal_error.test.lua
index 2e95431c6..0a72bf44b 100644
--- a/test/xlog/panic_on_wal_error.test.lua
+++ b/test/xlog/panic_on_wal_error.test.lua
@@ -10,7 +10,7 @@ _ = box.space.test:create_index('pk')
 -- reopen xlog
 --
 test_run:cmd("restart server default")
-box.space.test ~= nil
+assert(box.space.test ~= nil)
 -- insert some stuff
 -- 
 box.space.test:auto_increment{'before snapshot'}
diff --git a/test/xlog/reader.result b/test/xlog/reader.result
index 9985aa2ac..74ac3579e 100644
--- a/test/xlog/reader.result
+++ b/test/xlog/reader.result
@@ -40,7 +40,7 @@ trun:cmd("setopt delimiter ';'")
 ...
 function collect_results(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
diff --git a/test/xlog/reader.test.lua b/test/xlog/reader.test.lua
index 327af54dd..707ba394b 100644
--- a/test/xlog/reader.test.lua
+++ b/test/xlog/reader.test.lua
@@ -21,7 +21,7 @@ pattern_ok_v13 = fio.pathjoin(pattern_prefix, "v13/")
 trun:cmd("setopt delimiter ';'")
 function collect_results(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
diff --git a/test/xlog/snap_io_rate.test.lua b/test/xlog/snap_io_rate.test.lua
index f71296269..5626ea1f4 100644
--- a/test/xlog/snap_io_rate.test.lua
+++ b/test/xlog/snap_io_rate.test.lua
@@ -9,6 +9,6 @@ for i = 0, 127 do box.space.snap:replace({i, digest.urandom(512 * 1024)}) end
 t1 = fiber.time()
 box.snapshot()
 t2 = fiber.time()
-t2 - t1 > 64 / box.cfg.snap_io_rate_limit * 0.95
+assert(t2 - t1 > 64 / box.cfg.snap_io_rate_limit * 0.95)
 
 box.space.snap:drop()
diff --git a/test/xlog/transaction.result b/test/xlog/transaction.result
index 63adb0f25..376fea486 100644
--- a/test/xlog/transaction.result
+++ b/test/xlog/transaction.result
@@ -16,7 +16,7 @@ test_run:cmd("setopt delimiter ';'")
 ...
 function read_xlog(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
@@ -69,37 +69,37 @@ data = read_xlog(fio.pathjoin(box.cfg.wal_dir, string.rep('0', 20 - #lsn_str) ..
 ---
 ...
 -- check nothing changed for single row transactions
-data[1].HEADER.tsn == nil and data[1].HEADER.commit == nil
+assert(data[1].HEADER.tsn == nil and data[1].HEADER.commit == nil)
 ---
 - true
 ...
-data[2].HEADER.tsn == nil and data[2].HEADER.commit == nil
+assert(data[2].HEADER.tsn == nil and data[2].HEADER.commit == nil)
 ---
 - true
 ...
 -- check two row transaction
-data[3].HEADER.tsn == data[3].HEADER.lsn and data[3].HEADER.commit == nil
+assert(data[3].HEADER.tsn == data[3].HEADER.lsn and data[3].HEADER.commit == nil)
 ---
 - true
 ...
-data[4].HEADER.tsn == data[3].HEADER.tsn and data[4].HEADER.commit == true
+assert(data[4].HEADER.tsn == data[3].HEADER.tsn and data[4].HEADER.commit == true)
 ---
 - true
 ...
 -- check four row transaction
-data[5].HEADER.tsn == data[5].HEADER.lsn and data[5].HEADER.commit == nil
+assert(data[5].HEADER.tsn == data[5].HEADER.lsn and data[5].HEADER.commit == nil)
 ---
 - true
 ...
-data[6].HEADER.tsn == data[5].HEADER.tsn and data[6].HEADER.commit == nil
+assert(data[6].HEADER.tsn == data[5].HEADER.tsn and data[6].HEADER.commit == nil)
 ---
 - true
 ...
-data[7].HEADER.tsn == data[5].HEADER.tsn and data[7].HEADER.commit == nil
+assert(data[7].HEADER.tsn == data[5].HEADER.tsn and data[7].HEADER.commit == nil)
 ---
 - true
 ...
-data[8].HEADER.tsn == data[5].HEADER.tsn and data[8].HEADER.commit == true
+assert(data[8].HEADER.tsn == data[5].HEADER.tsn and data[8].HEADER.commit == true)
 ---
 - true
 ...
diff --git a/test/xlog/transaction.test.lua b/test/xlog/transaction.test.lua
index 2d8090b4c..c196064ef 100644
--- a/test/xlog/transaction.test.lua
+++ b/test/xlog/transaction.test.lua
@@ -6,7 +6,7 @@ test_run = env.new()
 test_run:cmd("setopt delimiter ';'")
 function read_xlog(file)
     local val = {}
-    for k, v in xlog(file) do
+    for _, v in xlog(file) do
         table.insert(val, setmetatable(v, { __serialize = "map"}))
     end
     return val
@@ -33,14 +33,14 @@ box.snapshot()
 lsn_str = tostring(lsn)
 data = read_xlog(fio.pathjoin(box.cfg.wal_dir, string.rep('0', 20 - #lsn_str) .. tostring(lsn_str) .. '.xlog'))
 -- check nothing changed for single row transactions
-data[1].HEADER.tsn == nil and data[1].HEADER.commit == nil
-data[2].HEADER.tsn == nil and data[2].HEADER.commit == nil
+assert(data[1].HEADER.tsn == nil and data[1].HEADER.commit == nil)
+assert(data[2].HEADER.tsn == nil and data[2].HEADER.commit == nil)
 -- check two row transaction
-data[3].HEADER.tsn == data[3].HEADER.lsn and data[3].HEADER.commit == nil
-data[4].HEADER.tsn == data[3].HEADER.tsn and data[4].HEADER.commit == true
+assert(data[3].HEADER.tsn == data[3].HEADER.lsn and data[3].HEADER.commit == nil)
+assert(data[4].HEADER.tsn == data[3].HEADER.tsn and data[4].HEADER.commit == true)
 -- check four row transaction
-data[5].HEADER.tsn == data[5].HEADER.lsn and data[5].HEADER.commit == nil
-data[6].HEADER.tsn == data[5].HEADER.tsn and data[6].HEADER.commit == nil
-data[7].HEADER.tsn == data[5].HEADER.tsn and data[7].HEADER.commit == nil
-data[8].HEADER.tsn == data[5].HEADER.tsn and data[8].HEADER.commit == true
+assert(data[5].HEADER.tsn == data[5].HEADER.lsn and data[5].HEADER.commit == nil)
+assert(data[6].HEADER.tsn == data[5].HEADER.tsn and data[6].HEADER.commit == nil)
+assert(data[7].HEADER.tsn == data[5].HEADER.tsn and data[7].HEADER.commit == nil)
+assert(data[8].HEADER.tsn == data[5].HEADER.tsn and data[8].HEADER.commit == true)
 box.space.test:drop()
diff --git a/test/xlog/xlog.lua b/test/xlog/xlog.lua
index 004096d2d..aaf1a0ae6 100644
--- a/test/xlog/xlog.lua
+++ b/test/xlog/xlog.lua
@@ -1,5 +1,5 @@
 #!/usr/bin/env tarantool
-os = require('os')
+local os = require('os')
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
-- 
2.23.0



More information about the Tarantool-patches mailing list