From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH] test: fix vinyl/errinj failure Date: Fri, 15 Mar 2019 19:25:46 +0300 Message-Id: <61756ccecf4f99169e945e87e7f72c70ac0f7cc6.1552667136.git.vdavydov.dev@gmail.com> To: tarantool-patches@freelists.org List-ID: 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