[tarantool-patches] [PATCH] Fix race condition in replication/gc test.

Serge Petrenko sergepetrenko at tarantool.org
Tue Jul 10 11:08:16 MSK 2018


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)





More information about the Tarantool-patches mailing list