[tarantool-patches] test: switched on pretest_clean routine

Alexander Tikhonov avtikhon at tarantool.org
Wed Mar 6 11:47:49 MSK 2019


test: switched on pretest_clean routine

Switched on pretest_clean routine which helps to cleanup
the test environment before test start. Also moved the global
functions in box suite into the test_helpers module, to make
it possible to use it in each of the test while global functions
are removing with pretest_clean routine.

---
Github pull request:  https://github.com/tarantool/tarantool/pull/4029  
Travis-CI:  https://travis-ci.org/tarantool/tarantool/builds/502431423  

From acbd981d79fe7b2ad5cdf5c2c1e9c1d3613d89c9 Mon Sep 17 00:00:00 2001
From: "Alexander V. Tikhonov" <avtikhon at tarantool.org>
Date: Wed, 6 Mar 2019 10:17:47 +0300
Subject: [PATCH] test: switched on pretest_clean routine

Switched on pretest_clean routine which helps to cleanup
the test environment before test start. Also moved the global
functions in box suite into the test_helpers module, to make
it possible to use it in each of the test while global functions
are removing with pretest_clean routine.
---
 test/app-tap/suite.ini                        |  1 +
 test/app/suite.ini                            |  1 +
 test/box-py/suite.ini                         |  1 +
 test/box-tap/suite.ini                        |  1 +
 test/box/admin.result                         |  5 +-
 test/box/admin.test.lua                       |  3 +-
 test/box/box.lua                              | 29 -----------
 test/box/cfg.result                           |  7 ++-
 test/box/cfg.test.lua                         |  6 ++-
 test/box/lua/test_helpers.lua                 | 32 ++++++++++++
 test/box/sql.result                           | 50 +++++++++++--------
 test/box/sql.test.lua                         | 46 +++++++++--------
 test/box/suite.ini                            |  3 +-
 test/engine/suite.ini                         |  1 +
 test/engine_long/delete_insert.result         |  5 +-
 test/engine_long/delete_insert.test.lua       |  5 +-
 test/engine_long/delete_replace_update.result | 13 +++--
 .../delete_replace_update.test.lua            | 12 +++--
 test/engine_long/suite.ini                    |  1 +
 test/engine_long/suite.lua                    |  7 ++-
 test/long_run-py/suite.ini                    |  1 +
 test/luajit-tap/suite.ini                     |  1 +
 test/replication-py/suite.ini                 |  1 +
 test/replication/suite.ini                    |  1 +
 test/sql-tap/suite.ini                        |  1 +
 test/sql/suite.ini                            |  1 +
 test/unit/suite.ini                           |  1 +
 test/vinyl/suite.ini                          |  1 +
 test/wal_off/suite.ini                        |  1 +
 test/xlog-py/suite.ini                        |  1 +
 test/xlog/suite.ini                           |  1 +
 31 files changed, 146 insertions(+), 94 deletions(-)
 create mode 100644 test/box/lua/test_helpers.lua

diff --git a/test/app-tap/suite.ini b/test/app-tap/suite.ini
index 86af82637..9629dfad5 100644
--- a/test/app-tap/suite.ini
+++ b/test/app-tap/suite.ini
@@ -3,3 +3,4 @@ core = app
 description = application server tests (TAP)
 lua_libs = lua/require_mod.lua lua/serializer_test.lua
 is_parallel = True
+pretest_clean = True
diff --git a/test/app/suite.ini b/test/app/suite.ini
index 7f3c0a8f5..4f9e51550 100644
--- a/test/app/suite.ini
+++ b/test/app/suite.ini
@@ -5,3 +5,4 @@ script = app.lua
 lua_libs = lua/fiber.lua
 use_unix_sockets = True
 is_parallel = True
+pretest_clean = True
diff --git a/test/box-py/suite.ini b/test/box-py/suite.ini
index d7d512b0d..cad0b0041 100644
--- a/test/box-py/suite.ini
+++ b/test/box-py/suite.ini
@@ -5,3 +5,4 @@ script = box.lua
 lua_libs = lua/fiber.lua lua/fifo.lua
 use_unix_sockets = True
 is_parallel = False
+pretest_clean = True
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index 50dc1f435..b3ccf2e6f 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -2,3 +2,4 @@
 core = app
 description = Database tests with #! using TAP
 is_parallel = True
+pretest_clean = True
diff --git a/test/box/admin.result b/test/box/admin.result
index e6fc1f302..cd5eb0c62 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)
+test_helpers = require('test_helpers')
+---
+...
+test_helpers.cfg_filter(box.cfg)
 ---
 - - - background
     - false
diff --git a/test/box/admin.test.lua b/test/box/admin.test.lua
index 4e7a78f5b..353afea9c 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)
+test_helpers = require('test_helpers')
+test_helpers.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..dcd52284c 100644
--- a/test/box/box.lua
+++ b/test/box/box.lua
@@ -8,32 +8,3 @@ 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
-
-function sorted(data)
-    table.sort(data, compare)
-    return data
-end
diff --git a/test/box/cfg.result b/test/box/cfg.result
index 7778f82ac..945372f41 100644
--- a/test/box/cfg.result
+++ b/test/box/cfg.result
@@ -1,3 +1,6 @@
+test_helpers = require('test_helpers')
+---
+...
 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)
+test_helpers.cfg_filter(box.cfg)
 ---
 - - - background
     - false
@@ -111,7 +114,7 @@ cfg_filter(box.cfg)
 box.cfg()
 ---
 ...
-cfg_filter(box.cfg)
+test_helpers.cfg_filter(box.cfg)
 ---
 - - - background
     - false
diff --git a/test/box/cfg.test.lua b/test/box/cfg.test.lua
index a6416241f..3189b5c2c 100644
--- a/test/box/cfg.test.lua
+++ b/test/box/cfg.test.lua
@@ -1,11 +1,13 @@
+test_helpers = require('test_helpers')
+
 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)
+test_helpers.cfg_filter(box.cfg)
 -- must be read-only
 box.cfg()
-cfg_filter(box.cfg)
+test_helpers.cfg_filter(box.cfg)
 
 -- check that cfg with unexpected parameter fails.
 box.cfg{sherlock = 'holmes'}
diff --git a/test/box/lua/test_helpers.lua b/test/box/lua/test_helpers.lua
new file mode 100644
index 000000000..bb231e73b
--- /dev/null
+++ b/test/box/lua/test_helpers.lua
@@ -0,0 +1,32 @@
+local test_helpers = {}
+
+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 test_helpers.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 test_helpers.cfg_filter(data[k])})
+    end
+    return result
+end
+
+function compare(a,b)
+    return a[1] < b[1]
+end
+
+function test_helpers.sorted(data)
+    table.sort(data, compare)
+    return data
+end
+
+return test_helpers
diff --git a/test/box/sql.result b/test/box/sql.result
index 78dc47167..c10434986 100644
--- a/test/box/sql.result
+++ b/test/box/sql.result
@@ -227,6 +227,9 @@ space = nil
 net_box = require('net.box')
 ---
 ...
+test_helpers = require('test_helpers')
+---
+...
 -- Prepare spaces
 box.schema.user.create('test', { password = 'test' })
 ---
@@ -275,7 +278,7 @@ space:insert{'Kytes', 'Tomas'}
 ---
 - ['Kytes', 'Tomas']
 ...
-sorted(space.index.secondary:select('Richard'))
+test_helpers.sorted(space.index.secondary:select('Richard'))
 ---
 - - ['Doe', 'Richard']
   - ['Roe', 'Richard']
@@ -284,7 +287,7 @@ sorted(space.index.secondary:select('Richard'))
 -- A test case for Bug#729879
 -- "Zero limit is treated the same as no limit"
 -- https://bugs.launchpad.net/tarantool/+bug/729879
-sorted(space.index.secondary:select('Richard', { limit = 0 }))
+test_helpers.sorted(space.index.secondary:select('Richard', { limit = 0 }))
 ---
 - []
 ...
@@ -301,7 +304,7 @@ space:insert{'Britney'}
 ---
 - error: Tuple field 2 required by space format is missing
 ...
-sorted(space.index.secondary:select('Anything'))
+test_helpers.sorted(space.index.secondary:select('Anything'))
 ---
 - []
 ...
@@ -309,7 +312,7 @@ space:insert{'Stephanie'}
 ---
 - error: Tuple field 2 required by space format is missing
 ...
-sorted(space.index.secondary:select('Anything'))
+test_helpers.sorted(space.index.secondary:select('Anything'))
 ---
 - []
 ...
@@ -321,11 +324,11 @@ space:select{'Spears'}
 ---
 - - ['Spears', 'Britney']
 ...
-sorted(space.index.secondary:select('Anything'))
+test_helpers.sorted(space.index.secondary:select('Anything'))
 ---
 - []
 ...
-sorted(space.index.secondary:select('Britney'))
+test_helpers.sorted(space.index.secondary:select('Britney'))
 ---
 - - ['Spears', 'Britney']
 ...
@@ -385,7 +388,7 @@ space:select{'key3'}
 ---
 - - ['key3', 'part1', 'part2_b']
 ...
-sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1'))
 ---
 - - ['key1', 'part1', 'part2']
   - ['key2', 'part1', 'part2_a']
@@ -418,7 +421,7 @@ space:select{'key3'}
 ---
 - - ['key3', 'part1', 'part2_b']
 ...
-sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1'))
 ---
 - - ['key1', 'part1', 'part2']
   - ['key2', 'part1', 'part2_a']
@@ -492,33 +495,33 @@ space:select{21234567}
 ---
 - - [21234567, 'part1', 'part2_a']
 ...
-sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1'))
 ---
 - - [1234567, 'part1', 'part2']
   - [11234567, 'part1', 'part2']
   - [21234567, 'part1', 'part2_a']
 ...
-sorted(space.index.secondary:select('part1_a'))
+test_helpers.sorted(space.index.secondary:select('part1_a'))
 ---
 - - [31234567, 'part1_a', 'part2']
   - [41234567, 'part1_a', 'part2_a']
 ...
-sorted(space.index.secondary:select('part_none'))
+test_helpers.sorted(space.index.secondary:select('part_none'))
 ---
 - []
 ...
-sorted(s.index[1]:select({'part1', 'part2'}))
+test_helpers.sorted(s.index[1]:select({'part1', 'part2'}))
 ---
 - - [1234567, 'part1', 'part2']
   - [11234567, 'part1', 'part2']
 ...
-sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1'))
 ---
 - - [1234567, 'part1', 'part2']
   - [11234567, 'part1', 'part2']
   - [21234567, 'part1', 'part2_a']
 ...
-sorted(space.index.secondary:select('part2'))
+test_helpers.sorted(space.index.secondary:select('part2'))
 ---
 - []
 ...
@@ -593,19 +596,22 @@ s = box.space.tweedledum
 ---
 ...
 -- Bug#929654 - secondary hash index is not built with build_indexes()
-sorted(space.index.secondary:select('hello'))
+test_helpers = require('test_helpers')
+---
+...
+test_helpers.sorted(space.index.secondary:select('hello'))
 ---
 - - [1, 'hello']
 ...
-sorted(space.index.secondary:select('brave'))
+test_helpers.sorted(space.index.secondary:select('brave'))
 ---
 - - [2, 'brave']
 ...
-sorted(space.index.secondary:select('new'))
+test_helpers.sorted(space.index.secondary:select('new'))
 ---
 - - [3, 'new']
 ...
-sorted(space.index.secondary:select('world'))
+test_helpers.sorted(space.index.secondary:select('world'))
 ---
 - - [4, 'world']
 ...
@@ -629,7 +635,7 @@ space:select{'Spears'}
 ---
 - - ['Spears', 'Britney']
 ...
-sorted(space.index.secondary:select('Britney'))
+test_helpers.sorted(space.index.secondary:select('Britney'))
 ---
 - - ['Spears', 'Britney']
 ...
@@ -712,7 +718,7 @@ space:insert{15, 'duplicate three'}
 ---
 - [15, 'duplicate three']
 ...
-sorted(space.index.secondary:select('duplicate one'))
+test_helpers.sorted(space.index.secondary:select('duplicate one'))
 ---
 - - [1, 'duplicate one']
   - [2, 'duplicate one']
@@ -720,7 +726,7 @@ sorted(space.index.secondary:select('duplicate one'))
   - [4, 'duplicate one']
   - [5, 'duplicate one']
 ...
-sorted(space.index.secondary:select('duplicate two'))
+test_helpers.sorted(space.index.secondary:select('duplicate two'))
 ---
 - - [6, 'duplicate two']
   - [7, 'duplicate two']
@@ -728,7 +734,7 @@ sorted(space.index.secondary:select('duplicate two'))
   - [9, 'duplicate two']
   - [10, 'duplicate two']
 ...
-sorted(space.index.secondary:select('duplicate three'))
+test_helpers.sorted(space.index.secondary:select('duplicate three'))
 ---
 - - [11, 'duplicate three']
   - [12, 'duplicate three']
diff --git a/test/box/sql.test.lua b/test/box/sql.test.lua
index 3d2a99b74..9db701142 100644
--- a/test/box/sql.test.lua
+++ b/test/box/sql.test.lua
@@ -90,6 +90,7 @@ box.space.test1:drop()
 box.schema.user.drop('test')
 space = nil
 net_box = require('net.box')
+test_helpers = require('test_helpers')
 
 -- Prepare spaces
 box.schema.user.create('test', { password = 'test' })
@@ -110,13 +111,13 @@ space:insert{'Roe', 'Richard'}
 space:insert{'Woe', 'Richard'}
 space:insert{'Major', 'Tomas'}
 space:insert{'Kytes', 'Tomas'}
-sorted(space.index.secondary:select('Richard'))
+test_helpers.sorted(space.index.secondary:select('Richard'))
 
 
 -- A test case for Bug#729879
 -- "Zero limit is treated the same as no limit"
 -- https://bugs.launchpad.net/tarantool/+bug/729879
-sorted(space.index.secondary:select('Richard', { limit = 0 }))
+test_helpers.sorted(space.index.secondary:select('Richard', { limit = 0 }))
 s:truncate()
 
 
@@ -128,13 +129,13 @@ s:truncate()
 -- get away with it.
 
 space:insert{'Britney'}
-sorted(space.index.secondary:select('Anything'))
+test_helpers.sorted(space.index.secondary:select('Anything'))
 space:insert{'Stephanie'}
-sorted(space.index.secondary:select('Anything'))
+test_helpers.sorted(space.index.secondary:select('Anything'))
 space:insert{'Spears', 'Britney'}
 space:select{'Spears'}
-sorted(space.index.secondary:select('Anything'))
-sorted(space.index.secondary:select('Britney'))
+test_helpers.sorted(space.index.secondary:select('Anything'))
+test_helpers.sorted(space.index.secondary:select('Britney'))
 
 s.index[0]:select('Spears', { limit = 100, iterator = 'GE' })
 s.index[1]:select('Britney', { limit = 100, iterator = 'GE' })
@@ -156,7 +157,7 @@ s.index[1]:select{}
 space:select{'key1'}
 space:select{'key2'}
 space:select{'key3'}
-sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1'))
 
 s.index[1]:select('part1', { limit = 100, iterator = 'GE' })
 s.index[0]:select('key2', { limit = 100, iterator = 'GE' })
@@ -164,7 +165,7 @@ s.index[1]:select({ 'part1', 'part2_a' }, { limit = 1, iterator = 'GE' })
 space:select{'key1'}
 space:select{'key2'}
 space:select{'key3'}
-sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1'))
 
 space:delete('key1')
 space:delete('key2')
@@ -188,14 +189,14 @@ l
 space:select{1234567}
 space:select{11234567}
 space:select{21234567}
-sorted(space.index.secondary:select('part1'))
-sorted(space.index.secondary:select('part1_a'))
-sorted(space.index.secondary:select('part_none'))
+test_helpers.sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part1_a'))
+test_helpers.sorted(space.index.secondary:select('part_none'))
 
-sorted(s.index[1]:select({'part1', 'part2'}))
+test_helpers.sorted(s.index[1]:select({'part1', 'part2'}))
 
-sorted(space.index.secondary:select('part1'))
-sorted(space.index.secondary:select('part2'))
+test_helpers.sorted(space.index.secondary:select('part1'))
+test_helpers.sorted(space.index.secondary:select('part2'))
 
 -- cleanup
 space:delete(1234567)
@@ -226,10 +227,11 @@ space = conn.space.tweedledum
 s = box.space.tweedledum
 
 -- Bug#929654 - secondary hash index is not built with build_indexes()
-sorted(space.index.secondary:select('hello'))
-sorted(space.index.secondary:select('brave'))
-sorted(space.index.secondary:select('new'))
-sorted(space.index.secondary:select('world'))
+test_helpers = require('test_helpers')
+test_helpers.sorted(space.index.secondary:select('hello'))
+test_helpers.sorted(space.index.secondary:select('brave'))
+test_helpers.sorted(space.index.secondary:select('new'))
+test_helpers.sorted(space.index.secondary:select('world'))
 s:truncate()
 
 -- A test case for: http://bugs.launchpad.net/bugs/735140
@@ -240,7 +242,7 @@ s.index.secondary:alter{type = 'tree', unique = false}
 
 space:insert{'Spears', 'Britney'}
 space:select{'Spears'}
-sorted(space.index.secondary:select('Britney'))
+test_helpers.sorted(space.index.secondary:select('Britney'))
 -- try to insert the incoplete tuple
 space:replace{'Spears'}
 -- check that nothing has been updated
@@ -268,9 +270,9 @@ space:insert{14, 'duplicate three'}
 space:insert{15, 'duplicate three'}
 
 
-sorted(space.index.secondary:select('duplicate one'))
-sorted(space.index.secondary:select('duplicate two'))
-sorted(space.index.secondary:select('duplicate three'))
+test_helpers.sorted(space.index.secondary:select('duplicate one'))
+test_helpers.sorted(space.index.secondary:select('duplicate two'))
+test_helpers.sorted(space.index.secondary:select('duplicate three'))
 
 space:delete(1)
 space:delete(2)
diff --git a/test/box/suite.ini b/test/box/suite.ini
index fee1c40b4..ee89dd64b 100644
--- a/test/box/suite.ini
+++ b/test/box/suite.ini
@@ -4,6 +4,7 @@ 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/test_helpers.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
+pretest_clean = True
diff --git a/test/engine/suite.ini b/test/engine/suite.ini
index 3f82a1325..ddc4c04e9 100644
--- a/test/engine/suite.ini
+++ b/test/engine/suite.ini
@@ -7,3 +7,4 @@ config = engine.cfg
 #disabled = replica_join.test.lua
 lua_libs = conflict.lua ../box/lua/utils.lua ../box/lua/push.lua
 is_parallel = True
+pretest_clean = True
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_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.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
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.ini b/test/engine_long/suite.ini
index a46c9535f..ff12f0b50 100644
--- a/test/engine_long/suite.ini
+++ b/test/engine_long/suite.ini
@@ -7,3 +7,4 @@ lua_libs = suite.lua
 use_unix_sockets = True
 config = engine.cfg
 is_parallel = False
+pretest_clean = True
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/long_run-py/suite.ini b/test/long_run-py/suite.ini
index 251f88af6..aacda0d91 100644
--- a/test/long_run-py/suite.ini
+++ b/test/long_run-py/suite.ini
@@ -8,3 +8,4 @@ release_disabled =
 lua_libs = suite.lua
 use_unix_sockets = True
 is_parallel = False
+pretest_clean = True
diff --git a/test/luajit-tap/suite.ini b/test/luajit-tap/suite.ini
index d5b1aa798..969742ec4 100644
--- a/test/luajit-tap/suite.ini
+++ b/test/luajit-tap/suite.ini
@@ -2,3 +2,4 @@
 core = app
 description = Luajit tests
 is_parallel = False
+pretest_clean = True
diff --git a/test/replication-py/suite.ini b/test/replication-py/suite.ini
index f0ae98896..49e28916a 100644
--- a/test/replication-py/suite.ini
+++ b/test/replication-py/suite.ini
@@ -3,3 +3,4 @@ core = tarantool
 script =  master.lua
 description = tarantool/box, replication
 is_parallel = False
+pretest_clean = True
diff --git a/test/replication/suite.ini b/test/replication/suite.ini
index 6e9e3edd0..74348b2d6 100644
--- a/test/replication/suite.ini
+++ b/test/replication/suite.ini
@@ -9,3 +9,4 @@ lua_libs = lua/fast_replica.lua lua/rlimit.lua
 use_unix_sockets = True
 long_run = prune.test.lua
 is_parallel = True
+pretest_clean = True
diff --git a/test/sql-tap/suite.ini b/test/sql-tap/suite.ini
index faa56a999..270b19bc9 100644
--- a/test/sql-tap/suite.ini
+++ b/test/sql-tap/suite.ini
@@ -11,3 +11,4 @@ release_disabled = debug_mode_only.test.lua
 long_run = gh-3332-tuple-format-leak.test.lua, gh-3083-ephemeral-unref-tuples.test.lua
 config = engine.cfg
 show_reproduce_content = False
+pretest_clean = True
diff --git a/test/sql/suite.ini b/test/sql/suite.ini
index ce6ccb79a..1ddbc684e 100644
--- a/test/sql/suite.ini
+++ b/test/sql/suite.ini
@@ -7,3 +7,4 @@ config = engine.cfg
 is_parallel = True
 lua_libs = lua/sql_tokenizer.lua
 release_disabled = errinj.test.lua view_delayed_wal.test.lua sql-debug.test.lua
+pretest_clean = True
diff --git a/test/unit/suite.ini b/test/unit/suite.ini
index 75c80ece1..df9b458ee 100644
--- a/test/unit/suite.ini
+++ b/test/unit/suite.ini
@@ -2,3 +2,4 @@
 core = unittest
 description = unit tests
 is_parallel = True
+pretest_clean = True
diff --git a/test/vinyl/suite.ini b/test/vinyl/suite.ini
index d2a194d85..3612cf44b 100644
--- a/test/vinyl/suite.ini
+++ b/test/vinyl/suite.ini
@@ -9,3 +9,4 @@ use_unix_sockets = True
 long_run = stress.test.lua large.test.lua write_iterator_rand.test.lua dump_stress.test.lua select_consistency.test.lua throttle.test.lua
 is_parallel = False
 disabled = upgrade.test.lua
+pretest_clean = True
diff --git a/test/wal_off/suite.ini b/test/wal_off/suite.ini
index bd3a349db..679104f82 100644
--- a/test/wal_off/suite.ini
+++ b/test/wal_off/suite.ini
@@ -4,3 +4,4 @@ script = wal.lua
 description = tarantool/box, wal_mode = none
 use_unix_sockets = True
 is_parallel = True
+pretest_clean = True
diff --git a/test/xlog-py/suite.ini b/test/xlog-py/suite.ini
index d7d512b0d..cad0b0041 100644
--- a/test/xlog-py/suite.ini
+++ b/test/xlog-py/suite.ini
@@ -5,3 +5,4 @@ script = box.lua
 lua_libs = lua/fiber.lua lua/fifo.lua
 use_unix_sockets = True
 is_parallel = False
+pretest_clean = True
diff --git a/test/xlog/suite.ini b/test/xlog/suite.ini
index 4043f3700..06cfbb068 100644
--- a/test/xlog/suite.ini
+++ b/test/xlog/suite.ini
@@ -9,3 +9,4 @@ config = suite.cfg
 use_unix_sockets = True
 long_run = snap_io_rate.test.lua
 is_parallel = True
+pretest_clean = True
-- 
2.17.1




-- 
Alexander Tikhonov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20190306/2aa54b7c/attachment.html>


More information about the Tarantool-patches mailing list