[PATCH] test: fix vinyl/errinj failure

Vladimir Davydov vdavydov.dev at gmail.com
Fri Mar 15 19:25:46 MSK 2019


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




More information about the Tarantool-patches mailing list