commit 9512fb7c29ec9db5341bf08c2b62adf048683747 from: Sergey Bronnikov date: Tue Sep 13 11:15:50 2022 UTC Run qsync tests with Molly commit - 0d5a12812be7231789fd38edd4aaf41bae361455 commit + 9512fb7c29ec9db5341bf08c2b62adf048683747 blob - 2fa67a4af18e971da593e11ec0d15236cc9b369b blob + 17b3407a47d9492d3cede76d57a6025ce001f382 --- test/tarantool/qsync_test.lua +++ test/tarantool/qsync_test.lua @@ -4,6 +4,10 @@ local Cluster = require('test.test-helpers.cluster') local server = require('test.test-helpers.server') local json = require('json') +local molly = require('molly') +local gen = molly.gen +local runner = molly.runner + local pg = t.group('quorum_master', { { engine = 'memtx' }, { engine = 'vinyl' } @@ -12,7 +16,6 @@ local pg = t.group('quorum_master', { pg.before_each(function(cg) local engine = cg.params.engine cg.cluster = Cluster:new({}) - cg.box_cfg = { replication = { server.build_instance_uri('master_quorum1'); @@ -57,7 +60,7 @@ pg.after_each(function(cg) cg.cluster:drop() end) -pg.before_test('test_qsync_basic', function(cg) +pg.before_each(function(cg) cg.cluster:add_server(cg.master_quorum1) cg.cluster:add_server(cg.master_quorum2) cg.cluster:add_server(cg.master_quorum3) @@ -72,7 +75,7 @@ pg.before_test('test_qsync_basic', function(cg) end) -pg.after_test('test_qsync_basic', function(cg) +pg.after_each(function(cg) cg.cluster:drop({ cg.master_quorum1, cg.master_quorum2, @@ -86,5 +89,49 @@ pg.test_qsync_basic = function(cg) t.assert_equals(cg.master_quorum1:eval('return box.space.test:insert{1}'), {1}) cg.master_quorum1:eval(('box.cfg{replication = %s}'):format(repl.replication)) cg.master_quorum2:wait_vclock_of(cg.master_quorum1) - --t.assert_equals(cg.master_quorum2:eval('return box.space.test:select()'), {{1}}) + t.assert_equals(cg.master_quorum2:eval('return box.space.test:select()'), {{1}}) end + +pg.test_qsync_bank = function(cg) + local repl = json.encode({replication = cg.box_cfg.replication}) + cg.master_quorum1:eval('box.cfg{replication = ""}') + t.assert_equals(cg.master_quorum1:eval('return box.space.test:insert{1}'), {1}) + cg.master_quorum1:eval(('box.cfg{replication = %s}'):format(repl.replication)) + cg.master_quorum2:wait_vclock_of(cg.master_quorum1) + t.assert_equals(cg.master_quorum2:eval('return box.space.test:select()'), {{1}}) + + local bank = require('test.tarantool.bank_client') + local read = bank.ops.read + local transfer = bank.ops.transfer + local test_options = { + threads = 5, + nodes = { + '127.0.0.1:3301', -- FIXME: should contain Tarantool's IP addresses. + }, + } + local ok, err = runner.run_test({ + client = bank.client, + generator = gen.cycle(gen.iter({ read(), transfer() })):take(10^3), + }, test_options) + t.assert_equals(err, nil) + t.assert_equals(ok, true) +end + +pg.test_qsync_cas_register = function(cg) + local cas_register = require('test.tarantool.cas_register_client') + local r = cas_register.ops.r + local w = cas_register.ops.w + local cas = cas_register.ops.cas + local test_options = { + threads = 5, + nodes = { + '127.0.0.1:3301', -- FIXME: should contain Tarantool's IP addresses. + }, + } + local ok, err = runner.run_test({ + client = cas_register.client, + generator = gen.cycle(gen.iter({ r, w, cas, })):take(1000), + }, test_options) + t.assert_equals(err, nil) + t.assert_equals(ok, true) +end