From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C718C42EF5C for ; Fri, 3 Jul 2020 00:14:06 +0300 (MSK) From: sergeyb@tarantool.org Date: Fri, 3 Jul 2020 00:13:33 +0300 Message-Id: <4100d5a297ab55f4c4b6441f43ca4b66d2b0bb48.1593723973.git.sergeyb@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 1/4] replication: regression test on gh-5119 [not fixed] List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org, sergepetrenko@tarantool.org, gorcunov@gmail.com, lvasiliev@tarantool.org From: Sergey Bronnikov --- .../gh-5119-sync_replication.result | 70 +++++++++++++++++++ .../gh-5119-sync_replication.skipcond | 2 + .../gh-5119-sync_replication.test.lua | 37 ++++++++++ 3 files changed, 109 insertions(+) create mode 100644 test/replication/gh-5119-sync_replication.result create mode 100755 test/replication/gh-5119-sync_replication.skipcond create mode 100644 test/replication/gh-5119-sync_replication.test.lua diff --git a/test/replication/gh-5119-sync_replication.result b/test/replication/gh-5119-sync_replication.result new file mode 100644 index 000000000..83851ebca --- /dev/null +++ b/test/replication/gh-5119-sync_replication.result @@ -0,0 +1,70 @@ +-- test-run result file version 2 +env = require('test_run') + | --- + | ... +test_run = env.new() + | --- + | ... +engine = test_run:get_cfg('engine') + | --- + | ... +fiber = require('fiber') + | --- + | ... + +box.schema.user.grant('guest', 'replication') + | --- + | ... +box.cfg{replication_synchro_quorum=2, replication_synchro_timeout=0.1} + | --- + | ... + +test_run:cmd('create server replica with rpl_master=default,\ + script="replication/replica.lua"') + | --- + | - true + | ... +test_run:cmd('start server replica with wait=True, wait_load=True') + | --- + | - true + | ... + +_ = box.schema.space.create('sync', {is_sync=true, engine=engine}) + | --- + | ... +_ = box.space.sync:create_index('pk') + | --- + | ... + +test_run:switch('default') + | --- + | - true + | ... +box.cfg{replication_synchro_quorum=3, replication_synchro_timeout=30} + | --- + | ... +test_run:cmd("setopt delimiter ';'") + | --- + | - true + | ... +_ = fiber.create(function() + box.space.sync:insert{1} +end); + | --- + | ... +test_run:cmd("setopt delimiter ''"); + | --- + | - true + | ... +box.cfg{replication_synchro_quorum=2, replication_synchro_timeout=0.1} + | --- + | ... +box.space.sync:insert{1} + | --- + | - error: Duplicate key exists in unique index 'pk' in space 'sync' + | ... +box.space.sync:insert{2} + | +box.space.sync:insert{3} + | [Lost current connection] +test_run:switch('replica') diff --git a/test/replication/gh-5119-sync_replication.skipcond b/test/replication/gh-5119-sync_replication.skipcond new file mode 100755 index 000000000..913ac004a --- /dev/null +++ b/test/replication/gh-5119-sync_replication.skipcond @@ -0,0 +1,2 @@ +# gh-5119 is opened +self.skip = 1 diff --git a/test/replication/gh-5119-sync_replication.test.lua b/test/replication/gh-5119-sync_replication.test.lua new file mode 100644 index 000000000..0331003b9 --- /dev/null +++ b/test/replication/gh-5119-sync_replication.test.lua @@ -0,0 +1,37 @@ +env = require('test_run') +test_run = env.new() +engine = test_run:get_cfg('engine') +fiber = require('fiber') + +box.schema.user.grant('guest', 'replication') +box.cfg{replication_synchro_quorum=2, replication_synchro_timeout=0.1} + +test_run:cmd('create server replica with rpl_master=default,\ + script="replication/replica.lua"') +test_run:cmd('start server replica with wait=True, wait_load=True') + +_ = box.schema.space.create('sync', {is_sync=true, engine=engine}) +_ = box.space.sync:create_index('pk') + +test_run:switch('default') +box.cfg{replication_synchro_quorum=3, replication_synchro_timeout=30} +test_run:cmd("setopt delimiter ';'") +_ = fiber.create(function() + box.space.sync:insert{1} +end); +test_run:cmd("setopt delimiter ''"); +box.cfg{replication_synchro_quorum=2, replication_synchro_timeout=0.1} +box.space.sync:insert{1} +box.space.sync:insert{2} +box.space.sync:insert{3} +test_run:switch('replica') +box.space.sync:select{} -- 1, 2, 3 +test_run:switch('default') +box.space.sync:truncate() + +-- Cleanup. +test_run:cmd('switch default') +test_run:cmd('stop server replica') +test_run:cmd('delete server replica') +box.space.sync:drop() +box.schema.user.revoke('guest', 'replication') -- 2.26.2