[Tarantool-patches] [PATCH 1/4] replication: regression test on gh-5119 [not fixed]

sergeyb at tarantool.org sergeyb at tarantool.org
Fri Jul 3 00:13:33 MSK 2020


From: Sergey Bronnikov <sergeyb at tarantool.org>

---
 .../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



More information about the Tarantool-patches mailing list