From d837c94ba22602f81ad8e2a5c3266daa13fc8ffa Mon Sep 17 00:00:00 2001
From: Sergei Voronezhskii <sergw@tarantool.org>
Date: Fri, 21 Sep 2018 11:26:14 +0300
Subject: [PATCH] test: enable parallel mode for wal_off tests

- Box configuration parameter `memtx_memory` is increased, because the
  test `lua` after `tuple` failed with the error:
  `Failed to allocate 368569 bytes in slab allocator for memtx_tuple`
  despite `collectgarbage('collect')` calls after cases with huge/many
  tuples.
  The statistics before the allocation fail gives the following values:
  ```
  box.slab.info()
  ---
  - items_size: 72786472
    items_used_ratio: 4.43%
    quota_size: 107374592
    quota_used_ratio: 93.75%
    arena_used_ratio: 6.1%
    items_used: 3222376
    quota_used: 100663296
    arena_size: 100663296
    arena_used: 6105960
  ```
  The reason of the fail seems to be a slab memory fragmentation. It is
  not clear for now whether we should consider this as a tarantool
  issue.

- Test `snapshot_stress` counts snapshot files present in the
  working directory and can reach the default 'checkpoint_count' value
  `2` if a previous test write its snapshots before.

- Restarting the default server w/o cleaning a working directory
  can leave a snapshot that holds a state saved at the middle of a test,
  before dropping of the space 'tweedledum' (because WAL is disabled),
  that can cause the error `Space 'tweedledum' already exists` for a
  following test.

- Use unix sockets because of errors `Address already in use`.

Part of #2436
---
 test/wal_off/oom.result     | 2 +-
 test/wal_off/oom.test.lua   | 2 +-
 test/wal_off/suite.ini      | 3 ++-
 test/wal_off/tuple.result   | 2 +-
 test/wal_off/tuple.test.lua | 2 +-
 test/wal_off/wal.lua        | 5 +++--
 6 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/test/wal_off/oom.result b/test/wal_off/oom.result
index c47d16c46e..90bc53d22b 100644
--- a/test/wal_off/oom.result
+++ b/test/wal_off/oom.result
@@ -4,7 +4,7 @@ env = require('test_run')
 test_run = env.new()
 ---
 ...
-test_run:cmd('restart server default')
+test_run:cmd('restart server default with cleanup=1')
 test_run:cmd("push filter 'error: Failed to allocate [0-9]+ ' to 'error: Failed to allocate <NUM> '")
 ---
 - true
diff --git a/test/wal_off/oom.test.lua b/test/wal_off/oom.test.lua
index 5c0ab8e73b..8e6e14046d 100644
--- a/test/wal_off/oom.test.lua
+++ b/test/wal_off/oom.test.lua
@@ -1,6 +1,6 @@
 env = require('test_run')
 test_run = env.new()
-test_run:cmd('restart server default')
+test_run:cmd('restart server default with cleanup=1')
 test_run:cmd("push filter 'error: Failed to allocate [0-9]+ ' to 'error: Failed to allocate <NUM> '")
 
 space = box.schema.space.create('tweedledum')
diff --git a/test/wal_off/suite.ini b/test/wal_off/suite.ini
index ad19eab104..bd3a349db0 100644
--- a/test/wal_off/suite.ini
+++ b/test/wal_off/suite.ini
@@ -2,4 +2,5 @@
 core = tarantool
 script = wal.lua
 description = tarantool/box, wal_mode = none
-is_parallel = False
+use_unix_sockets = True
+is_parallel = True
diff --git a/test/wal_off/tuple.result b/test/wal_off/tuple.result
index fa431e2039..6ea3814fc9 100644
--- a/test/wal_off/tuple.result
+++ b/test/wal_off/tuple.result
@@ -4,7 +4,7 @@ env = require('test_run')
 test_run = env.new()
 ---
 ...
-test_run:cmd("restart server default")
+test_run:cmd('restart server default with cleanup=1')
 -- 
 -- Test various tuple bugs which do not require a write ahead log.
 -- 
diff --git a/test/wal_off/tuple.test.lua b/test/wal_off/tuple.test.lua
index 19415a92d2..6962f35ad2 100644
--- a/test/wal_off/tuple.test.lua
+++ b/test/wal_off/tuple.test.lua
@@ -1,6 +1,6 @@
 env = require('test_run')
 test_run = env.new()
-test_run:cmd("restart server default")
+test_run:cmd('restart server default with cleanup=1')
 -- 
 -- Test various tuple bugs which do not require a write ahead log.
 -- 
diff --git a/test/wal_off/wal.lua b/test/wal_off/wal.lua
index 6e4afbe4df..4005e78cdc 100644
--- a/test/wal_off/wal.lua
+++ b/test/wal_off/wal.lua
@@ -2,9 +2,10 @@
 
 box.cfg{
     listen              = os.getenv("LISTEN"),
-    memtx_memory        = 107374182,
+    memtx_memory        = 157374182,
     pid_file            = "tarantool.pid",
-    wal_mode            = "none"
+    wal_mode            = "none",
+    checkpoint_count    = 100
 }
 
 require('console').listen(os.getenv('ADMIN'))
-- 
GitLab