From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 887641FB30 for ; Tue, 10 Jul 2018 04:08:31 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZN4rrI9HpqpB for ; Tue, 10 Jul 2018 04:08:31 -0400 (EDT) Received: from smtp43.i.mail.ru (smtp43.i.mail.ru [94.100.177.103]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 9B70D1FA2E for ; Tue, 10 Jul 2018 04:08:30 -0400 (EDT) From: Serge Petrenko Subject: [tarantool-patches] [PATCH] Fix race condition in replication/gc test. Date: Tue, 10 Jul 2018 11:08:16 +0300 Message-Id: <20180710080816.78918-1-sergepetrenko@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org 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)