Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: tarantool-patches@freelists.org
Subject: [PATCH] test: fix vinyl/errinj failure
Date: Fri, 15 Mar 2019 19:25:46 +0300	[thread overview]
Message-ID: <61756ccecf4f99169e945e87e7f72c70ac0f7cc6.1552667136.git.vdavydov.dev@gmail.com> (raw)

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

             reply	other threads:[~2019-03-15 16:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-15 16:25 Vladimir Davydov [this message]
2019-03-15 16:26 ` Vladimir Davydov

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=61756ccecf4f99169e945e87e7f72c70ac0f7cc6.1552667136.git.vdavydov.dev@gmail.com \
    --to=vdavydov.dev@gmail.com \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [PATCH] test: fix vinyl/errinj failure' \
    /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