From 337e55b1765bb2264751adcd66be1e6e362035fd Mon Sep 17 00:00:00 2001 From: Alexandr Lyapunov <a.lyapunov@corp.mail.ru> Date: Wed, 30 Dec 2015 19:12:59 +0300 Subject: [PATCH] Added more test cases to multiengine join test --- test/engine/replica_join.result | 117 +++++++++++++++++++++++++++++- test/engine/replica_join.test.lua | 44 ++++++++++- 2 files changed, 154 insertions(+), 7 deletions(-) diff --git a/test/engine/replica_join.result b/test/engine/replica_join.result index 16cfcc83bc..41a81dfa60 100644 --- a/test/engine/replica_join.result +++ b/test/engine/replica_join.result @@ -22,15 +22,125 @@ space = box.schema.space.create('test', { id = 99999, engine = engine }) index = space:create_index('primary', { type = index}) --- ... -for k = 1, 123 do space:insert{k, k*k} end +box.snapshot() +--- +- ok +... +-- replica join +test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +--- +- true +... +test_run:cmd("start server replica") +--- +- true +... +test_run:cmd('wait_lsn replica default') +--- +- true +... +test_run:cmd('switch replica') +--- +- true +... +box.space.test:select() +--- +- [] +... +test_run:cmd('switch default') +--- +- true +... +test_run:cmd("stop server replica") +--- +- true +... +_ = test_run:cmd("cleanup server replica") +--- +... +-- new data +_ = box.space.test:insert{1, 1} +--- +... +-- replica join +test_run:cmd("deploy server replica") +--- +- true +... +test_run:cmd("start server replica") +--- +- true +... +test_run:cmd('wait_lsn replica default') +--- +- true +... +test_run:cmd('switch replica') +--- +- true +... +box.space.test:select() +--- +- - [1, 1] +... +test_run:cmd('switch default') +--- +- true +... +test_run:cmd("stop server replica") +--- +- true +... +_ = test_run:cmd("cleanup server replica") --- ... +-- add snapshot box.snapshot() --- - ok ... -- replica join -test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") +test_run:cmd("deploy server replica") +--- +- true +... +test_run:cmd("start server replica") +--- +- true +... +test_run:cmd('wait_lsn replica default') +--- +- true +... +test_run:cmd('switch replica') +--- +- true +... +box.space.test:select() +--- +- - [1, 1] +... +test_run:cmd('switch default') +--- +- true +... +test_run:cmd("stop server replica") +--- +- true +... +_ = test_run:cmd("cleanup server replica") +--- +... +-- new data +for k = 2, 123 do box.space.test:insert{k, k*k} end +--- +... +box.snapshot() +--- +- ok +... +-- replica join +test_run:cmd("deploy server replica") --- - true ... @@ -180,9 +290,8 @@ test_run:cmd("stop server replica") --- - true ... -test_run:cmd("cleanup server replica") +_ = test_run:cmd("cleanup server replica") --- -- true ... space:drop() --- diff --git a/test/engine/replica_join.test.lua b/test/engine/replica_join.test.lua index 829bf1887c..df9332c7d7 100644 --- a/test/engine/replica_join.test.lua +++ b/test/engine/replica_join.test.lua @@ -2,26 +2,64 @@ env = require('test_run') test_run = env.new() engine = test_run:get_cfg('engine') index = test_run:get_cfg('index') - box.schema.user.grant('guest', 'read,write,execute', 'universe') box.schema.user.grant('guest', 'replication') space = box.schema.space.create('test', { id = 99999, engine = engine }) index = space:create_index('primary', { type = index}) -for k = 1, 123 do space:insert{k, k*k} end box.snapshot() -- replica join test_run:cmd("create server replica with rpl_master=default, script='replication/replica.lua'") test_run:cmd("start server replica") test_run:cmd('wait_lsn replica default') +test_run:cmd('switch replica') +box.space.test:select() +test_run:cmd('switch default') +test_run:cmd("stop server replica") +_ = test_run:cmd("cleanup server replica") + +-- new data +_ = box.space.test:insert{1, 1} + +-- replica join +test_run:cmd("deploy server replica") +test_run:cmd("start server replica") +test_run:cmd('wait_lsn replica default') +test_run:cmd('switch replica') +box.space.test:select() +test_run:cmd('switch default') +test_run:cmd("stop server replica") +_ = test_run:cmd("cleanup server replica") + +-- add snapshot +box.snapshot() +-- replica join +test_run:cmd("deploy server replica") +test_run:cmd("start server replica") +test_run:cmd('wait_lsn replica default') test_run:cmd('switch replica') box.space.test:select() +test_run:cmd('switch default') +test_run:cmd("stop server replica") +_ = test_run:cmd("cleanup server replica") + +-- new data +for k = 2, 123 do box.space.test:insert{k, k*k} end +box.snapshot() +-- replica join +test_run:cmd("deploy server replica") +test_run:cmd("start server replica") +test_run:cmd('wait_lsn replica default') +test_run:cmd('switch replica') +box.space.test:select() test_run:cmd('switch default') test_run:cmd("stop server replica") -test_run:cmd("cleanup server replica") +_ = test_run:cmd("cleanup server replica") + space:drop() box.snapshot() box.schema.user.revoke('guest', 'replication') box.schema.user.revoke('guest', 'read,write,execute', 'universe') + -- GitLab