Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH 1/1] pre_cleanup routine enabled with updated tests for it
@ 2019-02-26 14:49 Alexander Tikhonov
  2019-02-26 15:21 ` [tarantool-patches] " Alexander Tikhonov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Tikhonov @ 2019-02-26 14:49 UTC (permalink / raw)
  To: tarantool-patches, Alexander Turenko

[-- Attachment #1: Type: text/plain, Size: 7902 bytes --]


test: pre_cleanup routine switched on

Corrected and switched on the pre_cleanup routine,
which cleanups the schemas and functions between
running tests. All failed tests changed to be able to
run with the routine. At the box and engine_long suites
the common global functions moved to the modules
to avoid of its cleanup between tests.

Partly fix #3863

---

Travis-ci:  https://travis-ci.org/tarantool/tarantool/builds/498752667  
Branch:  https://github.com/tarantool/tarantool/tree/avtikhon/gh-3863-run-cleaner  

diff --git a/test-run b/test-run
index 02207efd2..7552a0e6a 160000
--- a/test-run
+++ b/test-run
@@ -1 +1 @@
-Subproject commit 02207efd2ca44067b76c79bf012f142016d929ae
+Subproject commit 7552a0e6a36f24d6961c16dd4e6e44c53e410567
diff --git a/test/box/admin.result b/test/box/admin.result
index e6fc1f302..2e93f386b 100644
--- a/test/box/admin.result
+++ b/test/box/admin.result
@@ -24,7 +24,10 @@ help()
       \help show this screen
       \quit quit interactive console
 ...
-cfg_filter(box.cfg)
+box_cfg_module = require('cfg_filter')
+---
+...
+box_cfg_module.cfg_filter(box.cfg)
 ---
 - - - background
     - false
diff --git a/test/box/admin.test.lua b/test/box/admin.test.lua
index 4e7a78f5b..bf587ccfc 100644
--- a/test/box/admin.test.lua
+++ b/test/box/admin.test.lua
@@ -6,7 +6,8 @@ space = box.schema.space.create('tweedledum')
 index = space:create_index('primary')
 
 help()
-cfg_filter(box.cfg)
+box_cfg_module = require('cfg_filter')
+box_cfg_module.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 b3b10ffd4..0fc93eaf0 100644
--- a/test/box/box.lua
+++ b/test/box/box.lua
@@ -9,26 +9,6 @@ box.cfg{
 
 require('console').listen(os.getenv('ADMIN'))
 
-local _hide = {
-    pid_file=1, log=1, listen=1, vinyl_dir=1,
-    memtx_dir=1, wal_dir=1,
-    memtx_max_tuple_size=1, memtx_min_tuple_size=1
-}
-
-function cfg_filter(data)
-    if type(data)~='table' then return data end
-    local keys,k,_ = {}
-    for k in pairs(data) do
-        table.insert(keys, k)
-    end
-    table.sort(keys)
-    local result = {}
-    for _,k in pairs(keys) do
-        table.insert(result, {k, _hide[k] and '<hidden>' or cfg_filter(data[k])})
-    end
-    return result
-end
-
 function compare(a,b)
     return a[1] < b[1]
 end
diff --git a/test/box/cfg.result b/test/box/cfg.result
index 7778f82ac..f0e755436 100644
--- a/test/box/cfg.result
+++ b/test/box/cfg.result
@@ -1,3 +1,6 @@
+box_cfg_module = require('cfg_filter')
+---
+...
 env = require('test_run')
 ---
 ...
@@ -12,7 +15,7 @@ box.cfg.nosuchoption = 1
 ---
 - error: 'builtin/box/load_cfg.lua:<line>: Attempt to modify a read-only table'
 ...
-cfg_filter(box.cfg)
+box_cfg_module.cfg_filter(box.cfg)
 ---
 - - - background
     - false
@@ -111,7 +114,7 @@ cfg_filter(box.cfg)
 box.cfg()
 ---
 ...
-cfg_filter(box.cfg)
+box_cfg_module.cfg_filter(box.cfg)
 ---
 - - - background
     - false
diff --git a/test/box/cfg.test.lua b/test/box/cfg.test.lua
index a6416241f..dcacb4d65 100644
--- a/test/box/cfg.test.lua
+++ b/test/box/cfg.test.lua
@@ -1,11 +1,13 @@
+box_cfg_module = require('cfg_filter')
+
 env = require('test_run')
 test_run = env.new()
 test_run:cmd("push filter '(error: .*)\\.lua:[0-9]+: ' to '\\1.lua:<line>: '")
 box.cfg.nosuchoption = 1
-cfg_filter(box.cfg)
+box_cfg_module.cfg_filter(box.cfg)
 -- must be read-only
 box.cfg()
-cfg_filter(box.cfg)
+box_cfg_module.cfg_filter(box.cfg)
 
 -- check that cfg with unexpected parameter fails.
 box.cfg{sherlock = 'holmes'}
diff --git a/test/box/lua/cfg_filter.lua b/test/box/lua/cfg_filter.lua
new file mode 100644
index 000000000..31b077c37
--- /dev/null
+++ b/test/box/lua/cfg_filter.lua
@@ -0,0 +1,23 @@
+local box_cfg_module = {}
+
+local _hide = {
+    pid_file=1, log=1, listen=1, vinyl_dir=1,
+    memtx_dir=1, wal_dir=1,
+    memtx_max_tuple_size=1, memtx_min_tuple_size=1
+}
+
+function box_cfg_module.cfg_filter(data)
+    if type(data)~='table' then return data end
+    local keys,k,_ = {}
+    for k in pairs(data) do
+        table.insert(keys, k)
+    end
+    table.sort(keys)
+    local result = {}
+    for _,k in pairs(keys) do
+        table.insert(result, {k, _hide[k] and '<hidden>' or box_cfg_module.cfg_filter(data[k])})
+    end
+    return result
+end
+
+return box_cfg_module
diff --git a/test/box/suite.ini b/test/box/suite.ini
index fee1c40b4..346536c1c 100644
--- a/test/box/suite.ini
+++ b/test/box/suite.ini
@@ -4,6 +4,6 @@ description = Database tests
 script = box.lua
 disabled = rtree_errinj.test.lua tuple_bench.test.lua
 release_disabled = errinj.test.lua errinj_index.test.lua rtree_errinj.test.lua upsert_errinj.test.lua iproto_stress.test.lua
-lua_libs = lua/fifo.lua lua/utils.lua lua/bitset.lua lua/index_random_test.lua lua/push.lua lua/identifier.lua
+lua_libs = lua/cfg_filter.lua lua/fifo.lua lua/utils.lua lua/bitset.lua lua/index_random_test.lua lua/push.lua lua/identifier.lua
 use_unix_sockets = True
 is_parallel = True
diff --git a/test/engine_long/delete_insert.test.lua b/test/engine_long/delete_insert.test.lua
index 275aaa23e..83119cf14 100644
--- a/test/engine_long/delete_insert.test.lua
+++ b/test/engine_long/delete_insert.test.lua
@@ -1,6 +1,9 @@
+el_mod = require("suite")
+
 test_run = require('test_run')
 inspector = test_run.new()
 engine = inspector:get_cfg('engine')
 iterations = 100000
+
 math.randomseed(1)
-delete_insert(engine, iterations)
+el_mod.delete_insert(engine, iterations)
diff --git a/test/engine_long/delete_replace_update.test.lua b/test/engine_long/delete_replace_update.test.lua
index 466b8f007..004597b15 100644
--- a/test/engine_long/delete_replace_update.test.lua
+++ b/test/engine_long/delete_replace_update.test.lua
@@ -1,17 +1,19 @@
+el_mod = require("suite")
+
 engine_name = 'memtx'
 iterations = 100000
 
 math.randomseed(1)
-delete_replace_update(engine_name, iterations)
+el_mod.delete_replace_update(engine_name, iterations)
 
 math.randomseed(2)
-delete_replace_update(engine_name, iterations)
+el_mod.delete_replace_update(engine_name, iterations)
 
 math.randomseed(3)
-delete_replace_update(engine_name, iterations)
+el_mod.delete_replace_update(engine_name, iterations)
 
 math.randomseed(4)
-delete_replace_update(engine_name, iterations)
+el_mod.delete_replace_update(engine_name, iterations)
 
 math.randomseed(5)
-delete_replace_update(engine_name, iterations)
+el_mod.delete_replace_update(engine_name, iterations)
diff --git a/test/engine_long/suite.lua b/test/engine_long/suite.lua
index 464138db1..4db885031 100644
--- a/test/engine_long/suite.lua
+++ b/test/engine_long/suite.lua
@@ -1,3 +1,4 @@
+local engine_long_module = {}
 
 function string_function()
     local random_number
@@ -10,7 +11,7 @@ function string_function()
     return random_string
 end
 
-function delete_replace_update(engine_name, iterations)
+function engine_long_module.delete_replace_update(engine_name, iterations)
     local string_value
     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
         box.space.tester:drop()
@@ -69,7 +70,7 @@ function delete_replace_update(engine_name, iterations)
     return {counter, random_number, string_value_2, string_value_3}
 end
 
-function delete_insert(engine_name, iterations)
+function engine_long_module.delete_insert(engine_name, iterations)
     local string_value
     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
         box.space.tester:drop()
@@ -107,3 +108,5 @@ function delete_insert(engine_name, iterations)
     box.space.tester:drop()
     return {counter, string_value_2}
 end
+
+return engine_long_module



-- 
Alexander Tikhonov

[-- Attachment #2: Type: text/html, Size: 10271 bytes --]

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

* [tarantool-patches] Re: [tarantool-patches] [PATCH 1/1] pre_cleanup routine enabled with updated tests for it
  2019-02-26 14:49 [tarantool-patches] [PATCH 1/1] pre_cleanup routine enabled with updated tests for it Alexander Tikhonov
@ 2019-02-26 15:21 ` Alexander Tikhonov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Tikhonov @ 2019-02-26 15:21 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Alexander Turenko

[-- Attachment #1: Type: text/plain, Size: 10306 bytes --]


Corrected a bit.

>Вторник, 26 февраля 2019, 17:49 +03:00 от Alexander Tikhonov <avtikhon@tarantool.org>:
>
>test: pre_cleanup routine switched on
>
>Corrected and switched on the pre_cleanup routine,
>which cleanups the schemas and functions between
>running tests. All failed tests changed to be able to
>run with the routine. At the box and engine_long suites
>the common global functions moved to the modules
>to avoid of its cleanup between tests.
>
>Partly fix #3863
>
>---
>
>Travis-ci:  https://travis-ci.org/tarantool/tarantool/builds/498779830
>Branch:  https://github.com/tarantool/tarantool/tree/avtikhon/gh-3863-run-cleaner
>
>diff --git a/test-run b/test-run
>index 02207efd2..7552a0e6a 160000
>--- a/test-run
>+++ b/test-run
>@@ -1 +1 @@
>-Subproject commit 02207efd2ca44067b76c79bf012f142016d929ae
>+Subproject commit 7552a0e6a36f24d6961c16dd4e6e44c53e410567
>diff --git a/test/box/admin.result b/test/box/admin.result
>index e6fc1f302..2e93f386b 100644
>--- a/test/box/admin.result
>+++ b/test/box/admin.result
>@@ -24,7 +24,10 @@ help()
>       \help show this screen
>       \quit quit interactive console
> ...
>-cfg_filter(box.cfg)
>+box_cfg_module = require('cfg_filter')
>+---
>+...
>+box_cfg_module.cfg_filter(box.cfg)
> ---
> - - - background
>     - false
>diff --git a/test/box/admin.test.lua b/test/box/admin.test.lua
>index 4e7a78f5b..bf587ccfc 100644
>--- a/test/box/admin.test.lua
>+++ b/test/box/admin.test.lua
>@@ -6,7 +6,8 @@ space = box.schema.space.create('tweedledum')
> index = space:create_index('primary')
>
> help()
>-cfg_filter(box.cfg)
>+box_cfg_module = require('cfg_filter')
>+box_cfg_module.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 b3b10ffd4..0fc93eaf0 100644
>--- a/test/box/box.lua
>+++ b/test/box/box.lua
>@@ -9,26 +9,6 @@ box.cfg{
>
> require('console').listen(os.getenv('ADMIN'))
>
>-local _hide = {
>-    pid_file=1, log=1, listen=1, vinyl_dir=1,
>-    memtx_dir=1, wal_dir=1,
>-    memtx_max_tuple_size=1, memtx_min_tuple_size=1
>-}
>-
>-function cfg_filter(data)
>-    if type(data)~='table' then return data end
>-    local keys,k,_ = {}
>-    for k in pairs(data) do
>-        table.insert(keys, k)
>-    end
>-    table.sort(keys)
>-    local result = {}
>-    for _,k in pairs(keys) do
>-        table.insert(result, {k, _hide[k] and '<hidden>' or cfg_filter(data[k])})
>-    end
>-    return result
>-end
>-
> function compare(a,b)
>     return a[1] < b[1]
> end
>diff --git a/test/box/cfg.result b/test/box/cfg.result
>index 7778f82ac..f0e755436 100644
>--- a/test/box/cfg.result
>+++ b/test/box/cfg.result
>@@ -1,3 +1,6 @@
>+box_cfg_module = require('cfg_filter')
>+---
>+...
> env = require('test_run')
> ---
> ...
>@@ -12,7 +15,7 @@ box.cfg.nosuchoption = 1
> ---
> - error: 'builtin/box/load_cfg.lua:<line>: Attempt to modify a read-only table'
> ...
>-cfg_filter(box.cfg)
>+box_cfg_module.cfg_filter(box.cfg)
> ---
> - - - background
>     - false
>@@ -111,7 +114,7 @@ cfg_filter(box.cfg)
> box.cfg()
> ---
> ...
>-cfg_filter(box.cfg)
>+box_cfg_module.cfg_filter(box.cfg)
> ---
> - - - background
>     - false
>diff --git a/test/box/cfg.test.lua b/test/box/cfg.test.lua
>index a6416241f..dcacb4d65 100644
>--- a/test/box/cfg.test.lua
>+++ b/test/box/cfg.test.lua
>@@ -1,11 +1,13 @@
>+box_cfg_module = require('cfg_filter')
>+
> env = require('test_run')
> test_run = env.new()
> test_run:cmd("push filter '(error: .*)\\.lua:[0-9]+: ' to '\\1.lua:<line>: '")
> box.cfg.nosuchoption = 1
>-cfg_filter(box.cfg)
>+box_cfg_module.cfg_filter(box.cfg)
> -- must be read-only
> box.cfg()
>-cfg_filter(box.cfg)
>+box_cfg_module.cfg_filter(box.cfg)
>
> -- check that cfg with unexpected parameter fails.
> box.cfg{sherlock = 'holmes'}
>diff --git a/test/box/lua/cfg_filter.lua b/test/box/lua/cfg_filter.lua
>new file mode 100644
>index 000000000..31b077c37
>--- /dev/null
>+++ b/test/box/lua/cfg_filter.lua
>@@ -0,0 +1,23 @@
>+local box_cfg_module = {}
>+
>+local _hide = {
>+    pid_file=1, log=1, listen=1, vinyl_dir=1,
>+    memtx_dir=1, wal_dir=1,
>+    memtx_max_tuple_size=1, memtx_min_tuple_size=1
>+}
>+
>+function box_cfg_module.cfg_filter(data)
>+    if type(data)~='table' then return data end
>+    local keys,k,_ = {}
>+    for k in pairs(data) do
>+        table.insert(keys, k)
>+    end
>+    table.sort(keys)
>+    local result = {}
>+    for _,k in pairs(keys) do
>+        table.insert(result, {k, _hide[k] and '<hidden>' or box_cfg_module.cfg_filter(data[k])})
>+    end
>+    return result
>+end
>+
>+return box_cfg_module
>diff --git a/test/box/suite.ini b/test/box/suite.ini
>index fee1c40b4..346536c1c 100644
>--- a/test/box/suite.ini
>+++ b/test/box/suite.ini
>@@ -4,6 +4,6 @@ description = Database tests
> script = box.lua
> disabled = rtree_errinj.test.lua tuple_bench.test.lua
> release_disabled = errinj.test.lua errinj_index.test.lua rtree_errinj.test.lua upsert_errinj.test.lua iproto_stress.test.lua
>-lua_libs = lua/fifo.lua lua/utils.lua lua/bitset.lua lua/index_random_test.lua lua/push.lua lua/identifier.lua
>+lua_libs = lua/cfg_filter.lua lua/fifo.lua lua/utils.lua lua/bitset.lua lua/index_random_test.lua lua/push.lua lua/identifier.lua
> use_unix_sockets = True
> is_parallel = True
>diff --git a/test/engine_long/delete_insert.test.lua b/test/engine_long/delete_insert.test.lua
>index 275aaa23e..83119cf14 100644
>--- a/test/engine_long/delete_insert.test.lua
>+++ b/test/engine_long/delete_insert.test.lua
>@@ -1,6 +1,9 @@
>+el_mod = require("suite")
>+
> test_run = require('test_run')
> inspector = test_run.new()
> engine = inspector:get_cfg('engine')
> iterations = 100000
>+
> math.randomseed(1)
>-delete_insert(engine, iterations)
>+el_mod.delete_insert(engine, iterations)
>diff --git a/test/engine_long/delete_replace_update.test.lua b/test/engine_long/delete_replace_update.test.lua
>index 466b8f007..004597b15 100644
>--- a/test/engine_long/delete_replace_update.test.lua
>+++ b/test/engine_long/delete_replace_update.test.lua
>@@ -1,17 +1,19 @@
>+el_mod = require("suite")
>+
> engine_name = 'memtx'
> iterations = 100000
>
> math.randomseed(1)
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
>
> math.randomseed(2)
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
>
> math.randomseed(3)
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
>
> math.randomseed(4)
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
>
> math.randomseed(5)
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
>diff --git a/test/engine_long/suite.lua b/test/engine_long/suite.lua
>index 464138db1..4db885031 100644
>--- a/test/engine_long/suite.lua
>+++ b/test/engine_long/suite.lua
>@@ -1,3 +1,4 @@
>+local engine_long_module = {}
>
> function string_function()
>     local random_number
>@@ -10,7 +11,7 @@ function string_function()
>     return random_string
> end
>
>-function delete_replace_update(engine_name, iterations)
>+function engine_long_module.delete_replace_update(engine_name, iterations)
>     local string_value
>     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
>         box.space.tester:drop()
>@@ -69,7 +70,7 @@ function delete_replace_update(engine_name, iterations)
>     return {counter, random_number, string_value_2, string_value_3}
> end
>
>-function delete_insert(engine_name, iterations)
>+function engine_long_module.delete_insert(engine_name, iterations)
>     local string_value
>     if (box.space._space.index.name:select{'tester'}[1] ~= nil) then
>         box.space.tester:drop()
>@@ -107,3 +108,5 @@ function delete_insert(engine_name, iterations)
>     box.space.tester:drop()
>     return {counter, string_value_2}
> end
>+
>+return engine_long_module
>diff --git a/test/engine_long/delete_insert.result b/test/engine_long/delete_insert.result
>index b1d504271..2cc46486a 100644
>--- a/test/engine_long/delete_insert.result
>+++ b/test/engine_long/delete_insert.result
>@@ -1,3 +1,6 @@
>+el_mod = require("suite")
>+---
>+...
> test_run = require('test_run')
> ---
> ...
>@@ -13,7 +16,7 @@ iterations = 100000
> math.randomseed(1)
> ---
> ...
>-delete_insert(engine, iterations)
>+el_mod.delete_insert(engine, iterations)
> ---
> - - 100000
>   - IAKGPQANAOSLARIFIBKB
>diff --git a/test/engine_long/delete_replace_update.result b/test/engine_long/delete_replace_update.result
>index 66cb9c82c..b75091945 100644
>--- a/test/engine_long/delete_replace_update.result
>+++ b/test/engine_long/delete_replace_update.result
>@@ -1,3 +1,6 @@
>+el_mod = require("suite")
>+---
>+...
> engine_name = 'memtx'
> ---
> ...
>@@ -7,7 +10,7 @@ iterations = 100000
> math.randomseed(1)
> ---
> ...
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
> ---
> - - 100000
>   - 3
>@@ -17,7 +20,7 @@ delete_replace_update(engine_name, iterations)
> math.randomseed(2)
> ---
> ...
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
> ---
> - - 100000
>   - 3
>@@ -27,7 +30,7 @@ delete_replace_update(engine_name, iterations)
> math.randomseed(3)
> ---
> ...
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
> ---
> - - 100000
>   - 1
>@@ -37,7 +40,7 @@ delete_replace_update(engine_name, iterations)
> math.randomseed(4)
> ---
> ...
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
> ---
> - - 100000
>   - 3
>@@ -47,7 +50,7 @@ delete_replace_update(engine_name, iterations)
> math.randomseed(5)
> ---
> ...
>-delete_replace_update(engine_name, iterations)
>+el_mod.delete_replace_update(engine_name, iterations)
> ---
> - - 100000
>   - 3
>
>-- 
>Alexander Tikhonov

-- 
Alexander Tikhonov

[-- Attachment #2: Type: text/html, Size: 13394 bytes --]

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

end of thread, other threads:[~2019-02-26 15:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26 14:49 [tarantool-patches] [PATCH 1/1] pre_cleanup routine enabled with updated tests for it Alexander Tikhonov
2019-02-26 15:21 ` [tarantool-patches] " Alexander Tikhonov

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