Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v7] test: fix luacheck warnings in test/vinyl
@ 2021-01-14  8:58 Sergey Bronnikov via Tarantool-patches
  2021-01-15 22:16 ` Vladislav Shpilevoy via Tarantool-patches
  2021-01-18 13:41 ` Kirill Yukhin via Tarantool-patches
  0 siblings, 2 replies; 3+ messages in thread
From: Sergey Bronnikov via Tarantool-patches @ 2021-01-14  8:58 UTC (permalink / raw)
  To: tarantool-patches, v.shpilevoy

From: Sergey Bronnikov <sergeyb@tarantool.org>

Closes #5466

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>
---
Changelog v7:

- reverted changes with redefinitions
- rebased to a master branch

Changelog v6:

- splitted patch in test/ for patches per sub-directory
- adjusted supressions in .luacheckrc
- fixed formatting issues in .luacheckrc
- fixed warnings in test/vinyl/vinyl.lua and test/vinyl/large.lua

Gitlab CI: https://gitlab.com/tarantool/tarantool/-/pipelines/241521801
Issue: https://github.com/tarantool/tarantool/issues/5466
Branch: ligurio/gh-5466-luacheck-warnings-test-vinyl

 .luacheckrc                                     |  2 +-
 test/box/lua/txn_proxy.lua                      |  6 +++---
 test/vinyl/large.lua                            |  3 +--
 test/vinyl/stress.lua                           | 10 +++++-----
 .../2.5.1/gh-5107-upsert-upgrade/fill.lua       |  4 ++--
 test/vinyl/vinyl.lua                            | 17 -----------------
 6 files changed, 12 insertions(+), 30 deletions(-)

diff --git a/.luacheckrc b/.luacheckrc
index 4b829f3dc..c90e113e5 100644
--- a/.luacheckrc
+++ b/.luacheckrc
@@ -44,7 +44,7 @@ exclude_files = {
     "test/sql/**/*.lua",
     "test/swim/**/*.lua",
     "test/var/**/*.lua",
-    "test/vinyl/**/*.lua",
+    "test/vinyl/*.test.lua",
     "test/wal_off/**/*.lua",
     "test/xlog/**/*.lua",
     "test/xlog-py/**/*.lua",
diff --git a/test/box/lua/txn_proxy.lua b/test/box/lua/txn_proxy.lua
index 7a4d0b865..15b0e4add 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/vinyl/large.lua b/test/vinyl/large.lua
index e10e94c1a..a997aec7e 100644
--- a/test/vinyl/large.lua
+++ b/test/vinyl/large.lua
@@ -1,5 +1,4 @@
-fiber = require('fiber')
-digest = require('digest')
+local digest = require('digest')
 
 local PAGE_SIZE = 1024
 local RANGE_SIZE = 64 * PAGE_SIZE
diff --git a/test/vinyl/stress.lua b/test/vinyl/stress.lua
index 5e8d89795..d8c1b631c 100644
--- a/test/vinyl/stress.lua
+++ b/test/vinyl/stress.lua
@@ -62,7 +62,7 @@ local function t2(ch, time_limit)
         local t = math.random(16)
         local space = spaces[math.fmod(t, #spaces) + 1]
         if t < 12 then
-            local l = space:get({k})
+            space:get({k})
         else
             space:delete({k})
         end
@@ -99,19 +99,19 @@ local function stress(time_limit)
 
     math.randomseed(os.time());
 
-    for i = 1, 6 do
+    for _ = 1, 6 do
         fiber.create(t1, ch, time_limit)
     end;
 
-    for i = 1, 6 do
+    for _ = 1, 6 do
         fiber.create(t2, ch, time_limit)
     end;
 
-    for i = 1, 4 do
+    for _ = 1, 4 do
         fiber.create(t3, ch, time_limit)
     end;
 
-    for i = 1, 16 do
+    for _ = 1, 16 do
         ch:get()
     end;
 end
diff --git a/test/vinyl/upgrade/2.5.1/gh-5107-upsert-upgrade/fill.lua b/test/vinyl/upgrade/2.5.1/gh-5107-upsert-upgrade/fill.lua
index 1916aea6e..64b375462 100644
--- a/test/vinyl/upgrade/2.5.1/gh-5107-upsert-upgrade/fill.lua
+++ b/test/vinyl/upgrade/2.5.1/gh-5107-upsert-upgrade/fill.lua
@@ -1,7 +1,7 @@
 box.cfg{}
 
-s = box.schema.create_space('test', {engine = 'vinyl'})
-pk = s:create_index('pk')
+local s = box.schema.create_space('test', {engine = 'vinyl'})
+s:create_index('pk')
 s:insert({1, 2})
 box.snapshot()
 s:upsert({1, 0}, {{'+', 2, 1}})
diff --git a/test/vinyl/vinyl.lua b/test/vinyl/vinyl.lua
index 31307f4bc..1d313b4e4 100644
--- a/test/vinyl/vinyl.lua
+++ b/test/vinyl/vinyl.lua
@@ -15,21 +15,4 @@ box.cfg {
     vinyl_max_tuple_size = 1024 * 1024 * 6,
 }
 
-function box_info_sort(data)
-    if type(data)~='table' then
-        return data
-    end
-    local keys = {}
-    for k in pairs(data) do
-        table.insert(keys, k)
-    end
-    table.sort(keys)
-    local result = {}
-    for _,k in pairs(keys) do
-        local v = data[k]
-        table.insert(result, {[k] = box_info_sort(v) })
-    end
-    return result
-end
-
 require('console').listen(os.getenv('ADMIN'))
-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-18 13:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-14  8:58 [Tarantool-patches] [PATCH v7] test: fix luacheck warnings in test/vinyl Sergey Bronnikov via Tarantool-patches
2021-01-15 22:16 ` Vladislav Shpilevoy via Tarantool-patches
2021-01-18 13:41 ` Kirill Yukhin via Tarantool-patches

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox