Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 04/12] test: enable cleaning of a test environment
Date: Tue, 26 Nov 2019 09:21:40 +0300	[thread overview]
Message-ID: <e2f4da06447920df5e0640db69550ed707faae1b.1574749278.git.avtikhon@tarantool.org> (raw)
In-Reply-To: <1c42ad20160f47d942cab405ce9896d6d31cc05f.1574749278.git.avtikhon@tarantool.org>
In-Reply-To: <1c42ad20160f47d942cab405ce9896d6d31cc05f.1574749278.git.avtikhon@tarantool.org>

From: Alexander Turenko <alexander.turenko@tarantool.org>

This commit enables pretest_clean test-run option on 'core = tarantool'
test suites with Lua tests and 'core = app' test suites. Consider #4094
for an example of a problem that is eliminated by this option.

For 'core = tarantool': this option drops non-system spaces, drops data
in system spaces and global variables to the initial state, unloads
packages except build-in ones.

For 'core = app': this option deletes xlog and snap files before run a
test.

test-run doesn't remove global variables that are listed in the
'protected_globals' global variable. Use it for, say, functions that are
defined in an instance file and called from tests.

Consider test-run/README.md for the information how exactly the option
works.

Removed unused cfg_filter() function from test/engine/box.lua.

Fixes #4094.

(cherry picked from commit 7474c14e9cdb4bae3ab073d375aa11e628e13aa5)
---
 test/app-tap/suite.ini     |  1 +
 test/app/suite.ini         |  1 +
 test/box-tap/suite.ini     |  1 +
 test/box/box.lua           |  4 +++-
 test/box/suite.ini         |  1 +
 test/engine/box.lua        | 21 ---------------------
 test/engine/suite.ini      |  1 +
 test/engine_long/suite.ini |  1 +
 test/engine_long/suite.lua |  5 +++--
 test/replication/suite.ini |  1 +
 test/vinyl/suite.ini       |  1 +
 test/wal_off/suite.ini     |  1 +
 test/xlog/suite.ini        |  1 +
 13 files changed, 16 insertions(+), 24 deletions(-)

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 134cba6d8..79432e29a 100644
--- a/test/app/suite.ini
+++ b/test/app/suite.ini
@@ -6,4 +6,5 @@ lua_libs = lua/fiber.lua
 use_unix_sockets = True
 use_unix_sockets_iproto = True
 is_parallel = True
+pretest_clean = True
 fragile = socket.test.lua ; gh-4426 gh-4451
diff --git a/test/box-tap/suite.ini b/test/box-tap/suite.ini
index d00e93e72..8d9e32d3f 100644
--- a/test/box-tap/suite.ini
+++ b/test/box-tap/suite.ini
@@ -2,5 +2,6 @@
 core = app
 description = Database tests with #! using TAP
 is_parallel = True
+pretest_clean = True
 fragile = cfg.test.lua     ; gh-4344
           key_def.test.lua ; gh-4252
diff --git a/test/box/box.lua b/test/box/box.lua
index b3b10ffd4..2a8e0e4fa 100644
--- a/test/box/box.lua
+++ b/test/box/box.lua
@@ -29,7 +29,7 @@ function cfg_filter(data)
     return result
 end
 
-function compare(a,b)
+local function compare(a,b)
     return a[1] < b[1]
 end
 
@@ -37,3 +37,5 @@ function sorted(data)
     table.sort(data, compare)
     return data
 end
+
+_G.protected_globals = {'cfg_filter', 'sorted'}
diff --git a/test/box/suite.ini b/test/box/suite.ini
index d636c45b3..6e8508188 100644
--- a/test/box/suite.ini
+++ b/test/box/suite.ini
@@ -8,6 +8,7 @@ lua_libs = lua/fifo.lua lua/utils.lua lua/bitset.lua lua/index_random_test.lua l
 use_unix_sockets = True
 use_unix_sockets_iproto = True
 is_parallel = True
+pretest_clean = True
 fragile = bitset.test.lua      ; gh-4095
           func_reload.test.lua ; gh-4425
           function1.test.lua   ; gh-4199
diff --git a/test/engine/box.lua b/test/engine/box.lua
index c68bd626c..b1a379daf 100644
--- a/test/engine/box.lua
+++ b/test/engine/box.lua
@@ -21,24 +21,3 @@ box.cfg{
 }
 
 require('console').listen(os.getenv('ADMIN'))
-
-_to_exclude = {
-    'pid_file', 'log', 'vinyl_dir',
-    'memtx_dir', 'wal_dir',
-    'memtx_min_tuple_size', 'memtx_max_tuple_size'
-}
-
-_exclude = {}
-for _, f in pairs(_to_exclude) do
-    _exclude[f] = 1
-end
-
-function cfg_filter(data)
-    local result = {}
-    for field, val in pairs(data) do
-        if _exclude[field] == nil then
-            result[field] = val
-        end
-    end
-    return result
-end
diff --git a/test/engine/suite.ini b/test/engine/suite.ini
index 7edd49ddc..7c260eea0 100644
--- a/test/engine/suite.ini
+++ b/test/engine/suite.ini
@@ -9,5 +9,6 @@ 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
 fragile = ddl.test.lua         ; gh-4353
           recover_wal.test.lua ; gh-3767
diff --git a/test/engine_long/suite.ini b/test/engine_long/suite.ini
index 0ebb7c9f8..97d869042 100644
--- a/test/engine_long/suite.ini
+++ b/test/engine_long/suite.ini
@@ -8,3 +8,4 @@ use_unix_sockets = True
 use_unix_sockets_iproto = True
 config = engine.cfg
 is_parallel = True
+pretest_clean = True
diff --git a/test/engine_long/suite.lua b/test/engine_long/suite.lua
index 464138db1..9ac2bff9f 100644
--- a/test/engine_long/suite.lua
+++ b/test/engine_long/suite.lua
@@ -1,5 +1,4 @@
-
-function string_function()
+local function string_function()
     local random_number
     local random_string
     random_string = ""
@@ -107,3 +106,5 @@ function delete_insert(engine_name, iterations)
     box.space.tester:drop()
     return {counter, string_value_2}
 end
+
+_G.protected_globals = {'delete_replace_update', 'delete_insert'}
diff --git a/test/replication/suite.ini b/test/replication/suite.ini
index d817f81a8..15dd05d25 100644
--- a/test/replication/suite.ini
+++ b/test/replication/suite.ini
@@ -10,6 +10,7 @@ use_unix_sockets = True
 use_unix_sockets_iproto = True
 long_run = prune.test.lua
 is_parallel = True
+pretest_clean = True
 fragile = errinj.test.lua            ; gh-3870
           join_vclock.test.lua       ; gh-4160
           long_row_timeout.test.lua  ; gh-4351
diff --git a/test/vinyl/suite.ini b/test/vinyl/suite.ini
index 90e326b46..1417d7156 100644
--- a/test/vinyl/suite.ini
+++ b/test/vinyl/suite.ini
@@ -9,6 +9,7 @@ use_unix_sockets = True
 use_unix_sockets_iproto = 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
+pretest_clean = True
 fragile = errinj.test.lua             ; gh-4346
           select_consistency.test.lua ; gh-4385
           throttle.test.lua           ; gh-4168
diff --git a/test/wal_off/suite.ini b/test/wal_off/suite.ini
index 10a02e999..14f531df7 100644
--- a/test/wal_off/suite.ini
+++ b/test/wal_off/suite.ini
@@ -5,4 +5,5 @@ description = tarantool/box, wal_mode = none
 use_unix_sockets = True
 use_unix_sockets_iproto = True
 is_parallel = True
+pretest_clean = True
 fragile = iterator_lt_gt.test.lua ; gh-3925
diff --git a/test/xlog/suite.ini b/test/xlog/suite.ini
index df54537ff..babf625ae 100644
--- a/test/xlog/suite.ini
+++ b/test/xlog/suite.ini
@@ -10,3 +10,4 @@ use_unix_sockets = True
 use_unix_sockets_iproto = True
 long_run = snap_io_rate.test.lua
 is_parallel = True
+pretest_clean = True
-- 
2.17.1

  parent reply	other threads:[~2019-11-26  6:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  6:21 [Tarantool-patches] [PATCH v1 01/12] test: enable parallel mode for xlog tests Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 02/12] test: enable parallel run for long test suites Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 03/12] test: replication parallel mode on Alexander V. Tikhonov
2019-11-26  6:21 ` Alexander V. Tikhonov [this message]
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 05/12] test: allow to run replication/misc multiple times Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 06/12] test: increase timeouts in replication/errinj Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 07/12] test: wait for xlog/snap/log file changes Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 08/12] test: use wait_cond to check follow status Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 09/12] test: increase timeouts in replication/misc Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 10/12] test: put require in proper places Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 11/12] test: fix replication/gc flaky failures Alexander V. Tikhonov
2019-11-26  6:21 ` [Tarantool-patches] [PATCH v1 12/12] test: errinj for pause relay_send Alexander V. Tikhonov
2019-11-26  6:54 ` [Tarantool-patches] [PATCH v1 01/12] test: enable parallel mode for xlog tests Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2f4da06447920df5e0640db69550ed707faae1b.1574749278.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 04/12] test: enable cleaning of a test environment' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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