[Tarantool-patches] [PATCH 2/4] replication: add advanced tests for sync replication
Sergey Bronnikov
sergeyb at tarantool.org
Fri Jul 3 01:46:12 MSK 2020
Forgot to fix unreliable piece of code in a test that makes test flaky.
Changes with fix are below, branch contains updated commit.
diff --git a/test/replication/qsync_advanced.result b/test/replication/qsync_advanced.result
index fa94c8339..53722c3f9 100644
--- a/test/replication/qsync_advanced.result
+++ b/test/replication/qsync_advanced.result
@@ -663,7 +663,7 @@ box.space.sync:drop()
| ---
| ...
--- check behaviour with failed write to WAL on master (ERRINJ_WAL_IO)
+-- Check behaviour with failed write to WAL on master (ERRINJ_WAL_IO).
-- Testcase setup.
test_run:switch('default')
| ---
@@ -849,15 +849,8 @@ test_run:switch('default')
| - true
| ...
-- Enable synchronous mode.
-s = box.space._space:get(box.space.sync.id)
- | ---
- | ...
-new_s = s:update({{'=', 6, {is_sync=true}}})
- | ---
- | ...
-box.space._space:replace(new_s)
+disable_sync_mode()
| ---
- | - [523, 1, 'sync', 'vinyl', 0, {'is_sync': true}, []]
| ...
-- Space is in sync mode now.
box.cfg{replication_synchro_quorum=NUM_INSTANCES, replication_synchro_timeout=0.1}
@@ -867,41 +860,28 @@ box.space.sync:insert{2} -- success
| ---
| - [2]
| ...
-box.space.sync:insert{3} -- success
- | ---
- | - [3]
- | ...
box.cfg{replication_synchro_quorum=BROKEN_QUORUM, replication_synchro_timeout=0.1}
| ---
| ...
-box.space.sync:insert{4} -- failure
- | ---
- | - error: Quorum collection for a synchronous transaction is timed out
- | ...
-box.cfg{replication_synchro_quorum=NUM_INSTANCES, replication_synchro_timeout=0.1}
- | ---
- | ...
-box.space.sync:insert{5} -- success
+box.space.sync:insert{3} -- success
| ---
- | - [5]
+ | - [3]
| ...
-box.space.sync:select{} -- 1, 2, 3, 5
+box.space.sync:select{} -- 1, 2, 3
| ---
| - - [1]
| - [2]
| - [3]
- | - [5]
| ...
test_run:cmd('switch replica')
| ---
| - true
| ...
-box.space.sync:select{} -- 1, 2, 3, 5
+box.space.sync:select{} -- 1, 2, 3
| ---
| - - [1]
| - [2]
| - [3]
- | - [5]
| ...
-- Testcase cleanup.
test_run:switch('default')
diff --git a/test/replication/qsync_advanced.test.lua b/test/replication/qsync_advanced.test.lua
index 270fd494d..9633ceb6c 100644
--- a/test/replication/qsync_advanced.test.lua
+++ b/test/replication/qsync_advanced.test.lua
@@ -307,20 +307,15 @@ test_run:cmd('switch replica')
box.space.sync:select{} -- 1
test_run:switch('default')
-- Enable synchronous mode.
-s = box.space._space:get(box.space.sync.id)
-new_s = s:update({{'=', 6, {is_sync=true}}})
-box.space._space:replace(new_s)
+disable_sync_mode()
-- Space is in sync mode now.
box.cfg{replication_synchro_quorum=NUM_INSTANCES, replication_synchro_timeout=0.1}
box.space.sync:insert{2} -- success
-box.space.sync:insert{3} -- success
box.cfg{replication_synchro_quorum=BROKEN_QUORUM, replication_synchro_timeout=0.1}
-box.space.sync:insert{4} -- failure
-box.cfg{replication_synchro_quorum=NUM_INSTANCES, replication_synchro_timeout=0.1}
-box.space.sync:insert{5} -- success
-box.space.sync:select{} -- 1, 2, 3, 5
+box.space.sync:insert{3} -- success
+box.space.sync:select{} -- 1, 2, 3
test_run:cmd('switch replica')
-box.space.sync:select{} -- 1, 2, 3, 5
+box.space.sync:select{} -- 1, 2, 3
-- Testcase cleanup.
test_run:switch('default')
box.space.sync:drop()
On 00:13 Fri 03 Jul , sergeyb at tarantool.org wrote:
> From: Sergey Bronnikov <sergeyb at tarantool.org>
>
> Part of #5055
> ---
> test/replication/qsync_advanced.result | 939 +++++++++++++++++++++++
> test/replication/qsync_advanced.test.lua | 337 ++++++++
> 2 files changed, 1276 insertions(+)
> create mode 100644 test/replication/qsync_advanced.result
> create mode 100644 test/replication/qsync_advanced.test.lua
More information about the Tarantool-patches
mailing list