Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	Kirill Yukhin <kyukhin@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v3] test: fix hanging of vinyl/[gh|iterator].test.lua
Date: Tue, 20 Oct 2020 12:01:27 +0300	[thread overview]
Message-ID: <020e17492aef4af6dd4065298a7fec7fa6082411.1603184379.git.avtikhon@tarantool.org> (raw)

Found that the previously fixed vinyl/gh.test.lua test in commit

  94dc5bddc1fb0f9e6ebebfc5aa6be586e5b6759e ('test: gh test hangs after gh-4957-too-many-upserts')

with adding fiber.sleep(1) workaround to avoid of raise from the
previously run vinyl/gh-4957-too-many-upserts.test.lua test can be
changed in the other way. The new change from one side will leave
the found issue untouched to be able to resolve it within opened
issue in github. And from the other side it will let the test-run
tool to be able to avoid of this issue using fragile list feature
to save the stability of testing due to found issue is flaky and
can be passed on reruns.

The current fix changes the forever waiting loop to especially
created for such situations test_run:wait_cond() routine which has
timeout in it to avoid of hanging the test till global timeout will
occure. It will let the testing to be continued even after the fail.

Also added box_snapshot() function to vinyl/gh.test.lua and
vinyl/iterator.test.lua tests to be able to avoid of printing changing
data in results file to be able to use its checksum in fragile list
of test-run to be able to rerun it as flaky issues.

Added checksum to fragile list:

  vinyl/gh.test.lua			gh-5141
  vinyl/iterator.test.lua		gh-5141

Part of #5141
---

Github: https://github.com/tarantool/tarantool/tree/avtikhon/gh-5141-gh_test
Issue: https://github.com/tarantool/tarantool/issues/5141

 test/vinyl/gh.result         | 28 ++++++++++++++++++----------
 test/vinyl/gh.test.lua       | 19 +++++++++++++------
 test/vinyl/iterator.result   | 26 ++++++++++++++++++--------
 test/vinyl/iterator.test.lua | 17 +++++++++++++----
 test/vinyl/suite.ini         |  6 +++---
 5 files changed, 65 insertions(+), 31 deletions(-)

diff --git a/test/vinyl/gh.result b/test/vinyl/gh.result
index 0fd74af83..5f568e7b1 100644
--- a/test/vinyl/gh.result
+++ b/test/vinyl/gh.result
@@ -7,7 +7,14 @@ env = require('test_run')
 test_run = env.new()
 ---
 ...
-fiber.sleep(1)
+function box_snapshot()                                  \
+    local ok, err = pcall(box.snapshot)                  \
+    if ok == false then                                  \
+        require('log').error(                            \
+            "box.snapshot() failed with error: " .. err) \
+    end                                                  \
+    return ok                                            \
+end
 ---
 ...
 -- gh-283: hang after three creates and drops
@@ -428,9 +435,9 @@ space = box.schema.space.create('test', { engine = 'vinyl' })
 pk = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}  })
 ---
 ...
-box.snapshot()
+box_snapshot()
 ---
-- ok
+- true
 ...
 space:drop()
 ---
@@ -556,17 +563,17 @@ s0:replace{1, 'tuple'}
 ---
 - [1, 'tuple']
 ...
-box.snapshot()
+box_snapshot()
 ---
-- ok
+- true
 ...
 s0:replace{2, 'tuple 2'}
 ---
 - [2, 'tuple 2']
 ...
-box.snapshot()
+box_snapshot()
 ---
-- ok
+- true
 ...
 s0:insert{3, 'tuple 3'}
 ---
@@ -602,9 +609,9 @@ _ = s:insert{1}
 _ = fiber.create(function() fiber.sleep(0.001) s:insert{2} end)
 ---
 ...
-box.snapshot()
+box_snapshot()
 ---
-- ok
+- true
 ...
 s:drop()
 ---
@@ -716,8 +723,9 @@ test_run:cmd("setopt delimiter ''");
 cont = false
 ---
 ...
-while finished ~= 2 do fiber.sleep(0.01) end
+test_run:wait_cond(function() return finished ~= 2 end)
 ---
+- true
 ...
 s:drop()
 ---
diff --git a/test/vinyl/gh.test.lua b/test/vinyl/gh.test.lua
index c72444f5f..3c0712642 100644
--- a/test/vinyl/gh.test.lua
+++ b/test/vinyl/gh.test.lua
@@ -2,7 +2,14 @@ fiber = require('fiber')
 env = require('test_run')
 test_run = env.new()
 
-fiber.sleep(1)
+function box_snapshot()                                  \
+    local ok, err = pcall(box.snapshot)                  \
+    if ok == false then                                  \
+        require('log').error(                            \
+            "box.snapshot() failed with error: " .. err) \
+    end                                                  \
+    return ok                                            \
+end
 
 -- gh-283: hang after three creates and drops
 s = box.schema.space.create('space0', {engine='vinyl'})
@@ -177,7 +184,7 @@ space:drop()
 
 space = box.schema.space.create('test', { engine = 'vinyl' })
 pk = space:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}  })
-box.snapshot()
+box_snapshot()
 space:drop()
 
 --
@@ -225,9 +232,9 @@ i0 = s0:create_index('primary', { type = 'tree', parts = {1, 'unsigned'}})
 
 -- integer keys
 s0:replace{1, 'tuple'}
-box.snapshot()
+box_snapshot()
 s0:replace{2, 'tuple 2'}
-box.snapshot()
+box_snapshot()
 
 s0:insert{3, 'tuple 3'}
 
@@ -245,7 +252,7 @@ s = box.schema.space.create('tweedledum', {engine='vinyl'})
 i = s:create_index('primary')
 _ = s:insert{1}
 _ = fiber.create(function() fiber.sleep(0.001) s:insert{2} end)
-box.snapshot()
+box_snapshot()
 s:drop()
 
 s = box.schema.space.create("test", {engine='vinyl'})
@@ -311,7 +318,7 @@ end;
 test_run:cmd("setopt delimiter ''");
 
 cont = false
-while finished ~= 2 do fiber.sleep(0.01) end
+test_run:wait_cond(function() return finished ~= 2 end)
 
 s:drop()
 
diff --git a/test/vinyl/iterator.result b/test/vinyl/iterator.result
index 0ef2a1b46..35d4582f4 100644
--- a/test/vinyl/iterator.result
+++ b/test/vinyl/iterator.result
@@ -20,6 +20,16 @@ iterator_next = function(iter) return iter.next() end
 iterate_over = function(iter) return iter.iterate_over() end
 ---
 ...
+function box_snapshot()                                  \
+    local ok, err = pcall(box.snapshot)                  \
+    if ok == false then                                  \
+        require('log').error(                            \
+            "box.snapshot() failed with error: " .. err) \
+    end                                                  \
+    return ok                                            \
+end
+---
+...
 --
 -- Following tests verify that combinations
 -- of various commands are worked correctly.
@@ -1369,9 +1379,9 @@ space4:replace({6})
 - [6]
 ...
 -- Snapshot for all spaces
-box.snapshot()
+box_snapshot()
 ---
-- ok
+- true
 ...
 -- Continue GT
 space2:replace({6})
@@ -1442,9 +1452,9 @@ space4:select{}
   - [8]
 ...
 -- Snapshot for all spaces
-box.snapshot()
+box_snapshot()
 ---
-- ok
+- true
 ...
 -- Continue GT
 iterate_over(iter_obj_sp2)
@@ -1903,9 +1913,9 @@ iterator_next(itr)
 ---
 - [2, 1]
 ...
-box.snapshot() -- create last-level run
+box_snapshot() -- create last-level run
 ---
-- ok
+- true
 ...
 iterator_next(itr)
 ---
@@ -1918,9 +1928,9 @@ iterator_next(itr)
 ---
 - [4, 1]
 ...
-box.snapshot() -- create not-last-level run
+box_snapshot() -- create not-last-level run
 ---
-- ok
+- true
 ...
 iterator_next(itr)
 ---
diff --git a/test/vinyl/iterator.test.lua b/test/vinyl/iterator.test.lua
index 8d2a85930..b96b04f2a 100644
--- a/test/vinyl/iterator.test.lua
+++ b/test/vinyl/iterator.test.lua
@@ -12,6 +12,15 @@ create_iterator = require('utils').create_iterator
 iterator_next = function(iter) return iter.next() end
 iterate_over = function(iter) return iter.iterate_over() end
 
+function box_snapshot()                                  \
+    local ok, err = pcall(box.snapshot)                  \
+    if ok == false then                                  \
+        require('log').error(                            \
+            "box.snapshot() failed with error: " .. err) \
+    end                                                  \
+    return ok                                            \
+end
+
 --
 -- Following tests verify that combinations
 -- of various commands are worked correctly.
@@ -468,7 +477,7 @@ iter_obj_sp4_2 = create_iterator(space4, 3, {iterator = box.index.LT})
 space4:replace({6})
 
 -- Snapshot for all spaces
-box.snapshot()
+box_snapshot()
 
 -- Continue GT
 space2:replace({6})
@@ -489,7 +498,7 @@ iterator_next(iter_obj_sp4_2)
 space4:select{}
 
 -- Snapshot for all spaces
-box.snapshot()
+box_snapshot()
 
 -- Continue GT
 iterate_over(iter_obj_sp2)
@@ -644,11 +653,11 @@ itr = create_iterator(s, {}, {})
 iterator_next(itr)
 for i=1,10 do s:upsert({i, 1}, {{'+', 2, 1}}) end
 iterator_next(itr)
-box.snapshot() -- create last-level run
+box_snapshot() -- create last-level run
 iterator_next(itr)
 for i=1,10 do s:upsert({i, 1}, {{'+', 2, 1}}) end
 iterator_next(itr)
-box.snapshot() -- create not-last-level run
+box_snapshot() -- create not-last-level run
 iterator_next(itr)
 for i=1,10 do s:upsert({i, 1}, {{'+', 2, 1}}) end
 iterator_next(itr)
diff --git a/test/vinyl/suite.ini b/test/vinyl/suite.ini
index 8e1db8ad9..edfbecd04 100644
--- a/test/vinyl/suite.ini
+++ b/test/vinyl/suite.ini
@@ -13,7 +13,7 @@ is_parallel = True
 disabled = upgrade.test.lua throttle.test.lua
 pretest_clean = True
 fragile = {
-    "retries": 10,
+    "retries": 100,
     "tests": {
         "tx_gap_lock.test.lua": {
             "issues": [ "gh-4309" ],
@@ -53,11 +53,11 @@ fragile = {
         },
         "gh.test.lua": {
             "issues": [ "gh-5141" ],
-            "checksums": [ "f1286e9e4710062ddfbffb61b2fe2743", "96b22440ab8a881d6b8d14c5ee1672fb" ]
+            "checksums": [ "f1286e9e4710062ddfbffb61b2fe2743", "96b22440ab8a881d6b8d14c5ee1672fb", "5de76c20f00952e8d3bbf585f95e3433", "df5a52cfb3b9453946d48307966a1398", "5cf57da66d0ee631bdc705662eadf1c7" ]
         },
         "iterator.test.lua": {
             "issues": [ "gh-5336" ],
-            "checksums": [ "138808fd31b68d1b1c53c6a146124856" ]
+            "checksums": [ "138808fd31b68d1b1c53c6a146124856", "76153860b305b780c8839e7e78a6a51f", "a012275613542b3fcd345e46fb00e903" ]
         },
         "ddl.test.lua": {
             "issues": [ "gh-5338" ],
-- 
2.25.1

             reply	other threads:[~2020-10-20  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20  9:01 Alexander V. Tikhonov [this message]
2020-10-20 20:46 ` Vladislav Shpilevoy

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=020e17492aef4af6dd4065298a7fec7fa6082411.1603184379.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v3] test: fix hanging of vinyl/[gh|iterator].test.lua' \
    /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