Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Fix race condition in replication/gc test.
@ 2018-07-10  8:08 Serge Petrenko
  2018-07-10  8:18 ` Vladimir Davydov
  0 siblings, 1 reply; 2+ messages in thread
From: Serge Petrenko @ 2018-07-10  8:08 UTC (permalink / raw)
  To: tarantool-patches; +Cc: Serge Petrenko

The test had a race condition: a replica could recieve updates before
we switch it off, which would cause master to delete one extra xlog
and the test to fail. Fix this by loosening checks. We now check if
there are 2 or 3 xlogs stored instead of only 3.
---
https://github.com/tarantool/tarantool/tree/sergepetrenko/replication-gc-test-fix

 test/replication/gc.result   | 5 ++++-
 test/replication/gc.test.lua | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/test/replication/gc.result b/test/replication/gc.result
index 992075594..7447abb62 100644
--- a/test/replication/gc.result
+++ b/test/replication/gc.result
@@ -315,7 +315,10 @@ box.snapshot()
 ---
 - true
 ...
-#fio.glob('./master/*.xlog') == 3 or fio.listdir('./master')
+ctr = #fio.glob('./master/*.xlog')
+---
+...
+ctr == 3 or ctr == 2 or fio.listdir('./master')
 ---
 - true
 ...
diff --git a/test/replication/gc.test.lua b/test/replication/gc.test.lua
index 92fb87446..95845193b 100644
--- a/test/replication/gc.test.lua
+++ b/test/replication/gc.test.lua
@@ -145,7 +145,8 @@ box.snapshot()
 _ = s:auto_increment{}
 box.snapshot()
 #box.info.gc().checkpoints == 1 or box.info.gc()
-#fio.glob('./master/*.xlog') == 3 or fio.listdir('./master')
+ctr = #fio.glob('./master/*.xlog')
+ctr == 3 or ctr == 2 or fio.listdir('./master')
 
 -- The xlog should only be deleted after the replica
 -- is unregistered.
-- 
2.15.2 (Apple Git-101.1)

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

end of thread, other threads:[~2018-07-10  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10  8:08 [tarantool-patches] [PATCH] Fix race condition in replication/gc test Serge Petrenko
2018-07-10  8:18 ` Vladimir Davydov

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