Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] test: fix vinyl/errinj failure
@ 2019-03-15 16:25 Vladimir Davydov
  2019-03-15 16:26 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Davydov @ 2019-03-15 16:25 UTC (permalink / raw)
  To: tarantool-patches

The patch fixes the following test failure:

 | --- vinyl/errinj.result Fri Mar 15 19:19:19 2019
 | +++ vinyl/errinj.reject Fri Mar 15 19:21:37 2019
 | @@ -854,7 +854,8 @@
 |  ...
 |  ret
 |  ---
 | -- - [3, 3]
 | +- - [2, 2]
 | +  - [3, 3]
 |  ...
 |  s:drop()
 |  ---

The error occurrs, because the test doesn't make sure that a read from
the scondary index actually occurs and the fiber does stall on a read
from the primary index. Use index stats to assure that.

Closes #3863
---
 test/vinyl/errinj.result   | 25 +++++++++++++++++++------
 test/vinyl/errinj.test.lua | 11 +++++++----
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/test/vinyl/errinj.result b/test/vinyl/errinj.result
index 9b5f7314..f4300333 100644
--- a/test/vinyl/errinj.result
+++ b/test/vinyl/errinj.result
@@ -830,16 +830,20 @@ errinj.set("ERRINJ_VY_DELAY_PK_LOOKUP", true)
 ---
 - ok
 ...
-f = fiber.create(do_read)
+_ = fiber.create(do_read)
 ---
 ...
-f:status()
+test_run:wait_cond(function() return sk:stat().get.rows > 0 end, 60)
 ---
-- suspended
+- true
 ...
-ret
+pk:stat().get.rows -- 0
 ---
-- null
+- 0
+...
+sk:stat().get.rows -- 1
+---
+- 1
 ...
 s:replace{2, 2}
 ---
@@ -849,8 +853,17 @@ errinj.set("ERRINJ_VY_DELAY_PK_LOOKUP", false)
 ---
 - ok
 ...
-while ret == nil do fiber.sleep(0.01) end
+test_run:wait_cond(function() return pk:stat().get.rows > 0 end, 60)
 ---
+- true
+...
+pk:stat().get.rows -- 1
+---
+- 1
+...
+sk:stat().get.rows -- 1
+---
+- 1
 ...
 ret
 ---
diff --git a/test/vinyl/errinj.test.lua b/test/vinyl/errinj.test.lua
index 5c7a525f..bb61a9a5 100644
--- a/test/vinyl/errinj.test.lua
+++ b/test/vinyl/errinj.test.lua
@@ -298,12 +298,15 @@ box.snapshot()
 ret = nil
 function do_read() ret = sk:select({2}, {iterator = 'GE'}) end
 errinj.set("ERRINJ_VY_DELAY_PK_LOOKUP", true)
-f = fiber.create(do_read)
-f:status()
-ret
+_ = fiber.create(do_read)
+test_run:wait_cond(function() return sk:stat().get.rows > 0 end, 60)
+pk:stat().get.rows -- 0
+sk:stat().get.rows -- 1
 s:replace{2, 2}
 errinj.set("ERRINJ_VY_DELAY_PK_LOOKUP", false)
-while ret == nil do fiber.sleep(0.01) end
+test_run:wait_cond(function() return pk:stat().get.rows > 0 end, 60)
+pk:stat().get.rows -- 1
+sk:stat().get.rows -- 1
 ret
 s:drop()
 
-- 
2.11.0

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-15 16:25 [PATCH] test: fix vinyl/errinj failure Vladimir Davydov
2019-03-15 16:26 ` Vladimir Davydov

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