diff --git a/test/helper.lua b/test/helper.lua index 2cd2a5da..4022b113 100644 --- a/test/helper.lua +++ b/test/helper.lua @@ -133,7 +133,7 @@ function helpers.insert_objects(g, space_name, objects) local inserted_objects = {} for _, obj in ipairs(objects) do - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', {space_name, obj}) + local result, err = g.router:call('crud.insert_object', {space_name, obj}) t.assert_equals(err, nil) @@ -354,7 +354,7 @@ function helpers.assert_ge(actual, expected, message) end function helpers.get_other_storage_bucket_id(cluster, bucket_id) - return cluster.main_server.net_box:eval([[ + return cluster:server('router'):eval([[ local vshard = require('vshard') local bucket_id = ... @@ -392,7 +392,7 @@ end helpers.tarantool_version_at_least = crud_utils.tarantool_version_at_least function helpers.update_sharding_key_cache(cluster, space_name) - return cluster.main_server.net_box:eval([[ + return cluster:server('router'):eval([[ local sharding_key = require('crud.common.sharding_key') local space_name = ... @@ -401,7 +401,7 @@ function helpers.update_sharding_key_cache(cluster, space_name) end function helpers.get_sharding_key_cache(cluster) - return cluster.main_server.net_box:eval([[ + return cluster:server('router'):eval([[ local vshard = require('vshard') local sharding_metadata_cache = require('crud.common.sharding.router_metadata_cache') @@ -416,7 +416,7 @@ end -- object through net.box that's why we get a sign of record -- existence of cache but not the cache itself function helpers.update_sharding_func_cache(cluster, space_name) - return cluster.main_server.net_box:eval([[ + return cluster:server('router'):eval([[ local sharding_func = require('crud.common.sharding_func') local space_name = ... @@ -433,7 +433,7 @@ end -- object through net.box that's why we get size of cache -- but not the cache itself function helpers.get_sharding_func_cache_size(cluster) - return cluster.main_server.net_box:eval([[ + return cluster:server('router'):eval([[ local vshard = require('vshard') local sharding_metadata_cache = require('crud.common.sharding.router_metadata_cache') @@ -734,6 +734,9 @@ function helpers.start_cluster(g, cartridge_cfg, vshard_cfg) vtest.cluster_new(g, g.cfg) g.cfg.engine = nil end + + g.router = g.cluster:server('router') + assert(g.router ~= nil, 'router found') end function helpers.stop_cluster(cluster, backend) @@ -744,14 +747,6 @@ function helpers.stop_cluster(cluster, backend) end end -function helpers.get_router(cluster, backend) - if backend == helpers.backend.CARTRIDGE then - return cluster:server('router') - elseif backend == helpers.backend.VSHARD then - return cluster.main_server - end -end - function helpers.parse_module_version(str) -- https://github.com/tarantool/luatest/blob/f37b353b77be50a1f1ce87c1ff2edf0c1b96d5d1/luatest/utils.lua#L166-L173 local splitstr = str:split('.') diff --git a/test/integration/borders_test.lua b/test/integration/borders_test.lua index 286a973e..5f5ddeb0 100644 --- a/test/integration/borders_test.lua +++ b/test/integration/borders_test.lua @@ -26,7 +26,7 @@ end) pgroup.test_non_existent_space = function(g) -- min - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'non_existent_space', nil, {mode = 'write'}, @@ -36,7 +36,7 @@ pgroup.test_non_existent_space = function(g) t.assert_str_contains(err.err, "Space \"non_existent_space\" doesn't exist") -- max - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'non_existent_space', nil, {mode = 'write'}, @@ -48,7 +48,7 @@ end pgroup.test_non_existent_index = function(g) -- min - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'non_existent_index', {mode = 'write'}, @@ -57,7 +57,7 @@ pgroup.test_non_existent_index = function(g) t.assert_equals(result, nil) t.assert_str_contains(err.err, "Index \"non_existent_index\" of space \"customers\" doesn't exist") - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 13, {mode = 'write'}, @@ -67,7 +67,7 @@ pgroup.test_non_existent_index = function(g) t.assert_str_contains(err.err, "Index \"13\" of space \"customers\" doesn't exist") -- max - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'non_existent_index', {mode = 'write'}, @@ -76,7 +76,7 @@ pgroup.test_non_existent_index = function(g) t.assert_equals(result, nil) t.assert_str_contains(err.err, "Index \"non_existent_index\" of space \"customers\" doesn't exist") - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 13, {mode = 'write'}, @@ -88,7 +88,7 @@ end pgroup.test_empty_space = function(g) -- min - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', nil, {mode = 'write'}, @@ -98,7 +98,7 @@ pgroup.test_empty_space = function(g) t.assert_equals(#result.rows, 0) -- min by age index with fields - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'age_index', {fields = {'name'}, mode = 'write'}, @@ -108,7 +108,7 @@ pgroup.test_empty_space = function(g) t.assert_equals(#result.rows, 0) -- max - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', nil, {mode = 'write'}, @@ -118,7 +118,7 @@ pgroup.test_empty_space = function(g) t.assert_equals(#result.rows, 0) -- max by age index with fields - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'age_index', {fields = {'name'}, mode = 'write'}, @@ -148,7 +148,7 @@ pgroup.test_min = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- by primary - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', nil, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -156,7 +156,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {1})) -- by primary, index ID is specified - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 0, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -164,7 +164,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {1})) -- by primary with fields - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', nil, {fields = {'name', 'last_name'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -172,7 +172,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, {{name = "Elizabeth", last_name = "Jackson"}}) -- by age index - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'age_index', {mode = 'write'}, }) t.assert_equals(err, nil) @@ -180,7 +180,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {4})) -- by age index, index ID is specified - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 2, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -188,7 +188,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {4})) -- by age index with fields - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'age_index', {fields = {'name', 'last_name'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -196,7 +196,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, {{name = "William", last_name = "White"}}) -- by composite index full_name - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'full_name', {mode = 'write'}, }) t.assert_equals(err, nil) @@ -204,7 +204,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {3})) -- by composite index full_name, index ID is specified - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 5, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -212,7 +212,7 @@ pgroup.test_min = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {3})) -- by composite index full_name with fields - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'full_name', {fields = {'name', 'last_name'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -240,7 +240,7 @@ pgroup.test_max = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- by primary - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', nil, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -248,7 +248,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {4})) -- by primary, index ID is specified - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 0, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -256,7 +256,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {4})) -- by primary with fields - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', nil, {fields = {'name', 'last_name'}, mode = 'write'} }) t.assert_equals(err, nil) @@ -264,7 +264,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, {{name = "William", last_name = "White"}}) -- by age index - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'age_index', {mode = 'write'}, }) t.assert_equals(err, nil) @@ -272,7 +272,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {2})) -- by age index, index ID is specified - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 2, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -280,7 +280,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {2})) -- by age index with fields - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'age_index', {fields = {'name', 'last_name'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -288,7 +288,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, {{name = "Mary", last_name = "Brown"}}) -- by composite index full_name - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'full_name', {mode = 'write'}, }) t.assert_equals(err, nil) @@ -296,7 +296,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {4})) -- by composite index full_name, index ID is specified - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 5, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -304,7 +304,7 @@ pgroup.test_max = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {4})) -- by composite index full_name with fields - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'full_name', {fields = {'name', 'last_name'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -334,7 +334,7 @@ pgroup.test_equal_secondary_keys = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- min - local result, err = g.cluster.main_server.net_box:call('crud.min', { + local result, err = g.router:call('crud.min', { 'customers', 'age_index', {mode = 'write'}, }) t.assert_equals(err, nil) @@ -342,7 +342,7 @@ pgroup.test_equal_secondary_keys = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {1})) -- max - local result, err = g.cluster.main_server.net_box:call('crud.max', { + local result, err = g.router:call('crud.max', { 'customers', 'age_index', {mode = 'write'}, }) t.assert_equals(err, nil) @@ -369,7 +369,7 @@ pgroup.test_opts_not_damaged = function(g) -- min local min_opts = {timeout = 1, fields = {'name', 'age'}, mode = 'write'} - local new_min_opts, err = g.cluster.main_server:eval([[ + local new_min_opts, err = g.router:eval([[ local crud = require('crud') local min_opts = ... @@ -384,7 +384,7 @@ pgroup.test_opts_not_damaged = function(g) -- max local max_opts = {timeout = 1, fields = {'name', 'age'}, mode = 'write'} - local new_max_opts, err = g.cluster.main_server:eval([[ + local new_max_opts, err = g.router:eval([[ local crud = require('crud') local max_opts = ... diff --git a/test/integration/cfg_test.lua b/test/integration/cfg_test.lua index 7f6f57e8..1c279472 100644 --- a/test/integration/cfg_test.lua +++ b/test/integration/cfg_test.lua @@ -7,8 +7,6 @@ local group = t.group('cfg', helpers.backend_matrix()) group.before_all(function(g) helpers.start_default_cluster(g, 'srv_stats') - - g.router = helpers.get_router(g.cluster, g.params.backend) end) group.after_all(function(g) @@ -159,7 +157,7 @@ group.test_role_cfg = function(g) stats_quantile_max_age_time = 180, } - g.cluster.main_server:upload_config({crud = cfg}) + g.router:upload_config({crud = cfg}) local actual_cfg = g.router:eval("return require('crud').cfg") t.assert_equals(cfg, actual_cfg) @@ -174,7 +172,7 @@ group.test_role_partial_cfg = function(g) local cfg_after = table.deepcopy(cfg_before) cfg_after.stats = not cfg_before.stats - g.cluster.main_server:upload_config({crud = {stats = cfg_after.stats}}) + g.router:upload_config({crud = {stats = cfg_after.stats}}) local actual_cfg = g.router:eval("return require('crud').cfg") t.assert_equals(cfg_after, actual_cfg, "Only requested field were updated") @@ -204,7 +202,7 @@ for name, case in pairs(role_cfg_error_cases) do group['test_role_cfg_' .. name] = function(g) helpers.skip_not_cartridge_backend(g.params.backend) local success, error = pcall(function() - g.cluster.main_server:upload_config(case.args) + g.router:upload_config(case.args) end) t.assert_equals(success, false) diff --git a/test/integration/count_test.lua b/test/integration/count_test.lua index 6fddd39c..fc3bcdb4 100644 --- a/test/integration/count_test.lua +++ b/test/integration/count_test.lua @@ -12,7 +12,6 @@ local pgroup = t.group('count', helpers.backend_matrix({ pgroup.before_all(function(g) helpers.start_default_cluster(g, 'srv_select') - g.router = helpers.get_router(g.cluster, g.params.backend) g.router.net_box:eval([[ require('crud').cfg{ stats = true } ]]) @@ -32,7 +31,7 @@ pgroup.before_each(function(g) end) pgroup.test_count_non_existent_space = function(g) - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'non_existent_space', nil, {fullscan = true, mode = 'write'}, @@ -43,7 +42,7 @@ pgroup.test_count_non_existent_space = function(g) end pgroup.test_count_empty_space = function(g) - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', nil, {fullscan = true, mode = 'write'}, @@ -58,7 +57,7 @@ pgroup.test_not_valid_value_type = function(g) {'==', 'id', 'not_number'} } - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, @@ -73,7 +72,7 @@ pgroup.test_not_valid_operation = function(g) {{}, 'id', 5} } - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {fullscan = true, mode = 'write'}, @@ -88,7 +87,7 @@ pgroup.test_conditions_with_non_existed_field = function(g) {'==', 'non_existed_field', 'value'} } - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, @@ -193,7 +192,7 @@ pgroup.test_count_all = function(g) }, }) - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', nil, {fullscan = true, mode = 'write'}, }) @@ -229,7 +228,7 @@ pgroup.test_count_all_with_yield_every = function(g) }, }) - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', nil, {yield_every = 1, fullscan = true, mode = 'write'}, }) @@ -265,7 +264,7 @@ pgroup.test_count_all_with_yield_every_0 = function(g) }, }) - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', nil, {yield_every = 0, fullscan = true, mode = 'write'} }) @@ -303,7 +302,7 @@ pgroup.test_count_by_primary_index = function(g) local conditions = {{'==', 'id_index', 3}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, }) @@ -345,7 +344,7 @@ pgroup.test_eq_condition_with_index = function(g) local expected_len = 2 - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, }) @@ -387,7 +386,7 @@ pgroup.test_ge_condition_with_index = function(g) local expected_len = 3 - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -429,7 +428,7 @@ pgroup.test_gt_condition_with_index = function(g) local expected_len = 1 - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -471,7 +470,7 @@ pgroup.test_le_condition_with_index = function(g) local expected_len = 4 - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -513,7 +512,7 @@ pgroup.test_lt_condition_with_index = function(g) local expected_len = 2 - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -557,7 +556,7 @@ pgroup.test_multiple_conditions = function(g) local expected_len = 2 - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, }) @@ -579,7 +578,7 @@ pgroup.test_multipart_primary_index = function(g) }) local conditions = {{'=', 'primary', 0}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'coord', conditions, {mode = 'write'}, }) @@ -587,7 +586,7 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(result, 3) local conditions = {{'=', 'primary', {0, 2}}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'coord', conditions, {mode = 'write'}, }) @@ -621,7 +620,7 @@ pgroup.test_opts_not_damaged = function(g) balance = false, fullscan = true } - local new_count_opts, err = g.cluster.main_server:eval([[ + local new_count_opts, err = g.router:eval([[ local crud = require('crud') local count_opts = ... @@ -660,7 +659,7 @@ pgroup.test_count_no_map_reduce = function(g) local map_reduces_before = helpers.get_map_reduces_stat(router, 'customers') -- Case: no conditions, just bucket id. - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', nil, {bucket_id = 2804, timeout = 1, fullscan = true, mode = 'write'}, @@ -674,7 +673,7 @@ pgroup.test_count_no_map_reduce = function(g) -- Case: EQ on secondary index, which is not in the sharding -- index (primary index in the case). - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', {{'==', 'age', 81}}, {bucket_id = 1161, timeout = 1, mode = 'write'}, @@ -723,7 +722,7 @@ pgroup.test_count_timeout = function(g) local timeout = 4 local begin = clock.proc() - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {timeout = timeout, fullscan = true, mode = 'write'}, }) @@ -765,7 +764,7 @@ pgroup.test_composite_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -777,7 +776,7 @@ pgroup.test_composite_index = function(g) {'==', 'full_name', "Elizabeth"}, } - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, }) @@ -799,7 +798,7 @@ pgroup.test_composite_primary_index = function(g) local conditions = {{'=', 'id', {5, 'Ukrainian', 55}}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'book_translation', conditions, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -835,7 +834,7 @@ pgroup.test_count_by_full_sharding_key = function(g) }) local conditions = {{'==', 'id', 3}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', conditions, {mode = 'write'}, }) @@ -846,7 +845,7 @@ end pgroup.test_count_force_map_call = function(g) local key = 1 - local first_bucket_id = g.cluster.main_server.net_box:eval([[ + local first_bucket_id = g.router:eval([[ local vshard = require('vshard') local key = ... @@ -867,14 +866,14 @@ pgroup.test_count_force_map_call = function(g) }, }) - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers', {{'==', 'id', key}}, {mode = 'write'}, }) t.assert_equals(err, nil) t.assert_equals(result, 1) - result, err = g.cluster.main_server.net_box:call('crud.count', { + result, err = g.router:call('crud.count', { 'customers', {{'==', 'id', key}}, {force_map_call = true, mode = 'write'}, }) diff --git a/test/integration/custom_bucket_id_test.lua b/test/integration/custom_bucket_id_test.lua index c0338d5d..075112f1 100644 --- a/test/integration/custom_bucket_id_test.lua +++ b/test/integration/custom_bucket_id_test.lua @@ -24,7 +24,7 @@ pgroup.before_each(function(g) end) local function get_other_storage_bucket_id(g, key) - local bucket_id = g.cluster.main_server.net_box:eval([[ + local bucket_id = g.router:eval([[ local vshard = require('vshard') local key = ... @@ -38,7 +38,7 @@ local function get_other_storage_bucket_id(g, key) end local function check_get(g, space_name, id, bucket_id, tuple) - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { space_name, id, {mode = 'write'}, }) @@ -47,7 +47,7 @@ local function check_get(g, space_name, id, bucket_id, tuple) t.assert_equals(#result.rows, 0) -- get w/ right bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { space_name, id, {bucket_id = bucket_id, mode = 'write'}, }) @@ -66,7 +66,7 @@ pgroup.test_update = function(g) } -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -75,7 +75,7 @@ pgroup.test_update = function(g) t.assert_equals(#result.rows, 1) -- update w/ default bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers', tuple[1], update_operations, }) @@ -85,7 +85,7 @@ pgroup.test_update = function(g) t.assert_equals(#result.rows, 0) -- update w/ right bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers', tuple[1], update_operations, {bucket_id = bucket_id}, }) @@ -99,7 +99,7 @@ pgroup.test_delete = function(g) local bucket_id = get_other_storage_bucket_id(g, tuple[1]) -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -108,7 +108,7 @@ pgroup.test_delete = function(g) t.assert_equals(#result.rows, 1) -- delete w/ default bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.delete', { + local result, err = g.router:call('crud.delete', { 'customers', tuple[1], }) @@ -118,7 +118,7 @@ pgroup.test_delete = function(g) -- just get tuple to check it wasn't deleted -- get w/ right bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', tuple[1], {bucket_id = bucket_id, mode = 'write'}, }) @@ -128,7 +128,7 @@ pgroup.test_delete = function(g) t.assert_equals(#result.rows, 1) -- delete w/ right bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.delete', { + local result, err = g.router:call('crud.delete', { 'customers', tuple[1], {bucket_id = bucket_id}, }) @@ -136,7 +136,7 @@ pgroup.test_delete = function(g) t.assert_not_equals(result, nil) -- get w/ right bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', tuple[1], {bucket_id = bucket_id, mode = 'write'}, }) @@ -154,7 +154,7 @@ pgroup.test_insert_object = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- insert_object - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', { + local result, err = g.router:call('crud.insert_object', { 'customers', object, {bucket_id = bucket_id}, }) @@ -172,7 +172,7 @@ pgroup.test_insert_object_bucket_id_opt = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- insert_object - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', { + local result, err = g.router:call('crud.insert_object', { 'customers', object, {bucket_id = bucket_id}, }) @@ -191,7 +191,7 @@ pgroup.test_insert_object_bucket_id_specified_twice = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- insert_object, opts.bucket_id is different - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', { + local result, err = g.router:call('crud.insert_object', { 'customers', object, {bucket_id = bucket_id + 1}, }) @@ -199,7 +199,7 @@ pgroup.test_insert_object_bucket_id_specified_twice = function(g) t.assert_str_contains(err.err, 'Tuple and opts.bucket_id contain different bucket_id values') -- insert_object, opts.bucket_id is the same - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', { + local result, err = g.router:call('crud.insert_object', { 'customers', object, {bucket_id = bucket_id}, }) @@ -216,7 +216,7 @@ pgroup.test_insert = function(g) tuple[2] = bucket_id -- insert - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, }) @@ -235,7 +235,7 @@ pgroup.test_insert_bucket_id_opt = function(g) tuple_with_bucket_id[2] = bucket_id -- insert - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, {bucket_id = bucket_id}, }) @@ -252,7 +252,7 @@ pgroup.test_insert_bucket_id_specified_twice = function(g) tuple[2] = bucket_id -- insert, opts.bucket_id is different - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, {bucket_id = bucket_id + 1} }) @@ -260,7 +260,7 @@ pgroup.test_insert_bucket_id_specified_twice = function(g) t.assert_str_contains(err.err, 'Tuple and opts.bucket_id contain different bucket_id values') -- insert, opts.bucket_id is the same - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -279,7 +279,7 @@ pgroup.test_replace_object = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- replace_object - local result, err = g.cluster.main_server.net_box:call('crud.replace_object', { + local result, err = g.router:call('crud.replace_object', { 'customers', object, }) @@ -297,7 +297,7 @@ pgroup.test_replace_object_bucket_id_opt = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- replace_object - local result, err = g.cluster.main_server.net_box:call('crud.replace_object', { + local result, err = g.router:call('crud.replace_object', { 'customers', object, {bucket_id = bucket_id} }) @@ -316,7 +316,7 @@ pgroup.test_replace_object_bucket_id_specified_twice = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- replace_object, opts.bucket_id is different - local result, err = g.cluster.main_server.net_box:call('crud.replace_object', { + local result, err = g.router:call('crud.replace_object', { 'customers', object, {bucket_id = bucket_id + 1} }) @@ -324,7 +324,7 @@ pgroup.test_replace_object_bucket_id_specified_twice = function(g) t.assert_str_contains(err.err, 'Tuple and opts.bucket_id contain different bucket_id values') -- replace_object, opts.bucket_id is the same - local result, err = g.cluster.main_server.net_box:call('crud.replace_object', { + local result, err = g.router:call('crud.replace_object', { 'customers', object, {bucket_id = bucket_id} }) @@ -341,7 +341,7 @@ pgroup.test_replace = function(g) tuple[2] = bucket_id -- replace - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -360,7 +360,7 @@ pgroup.test_replace_bucket_id_opt = function(g) tuple_with_bucket_id[2] = bucket_id -- replace - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -377,7 +377,7 @@ pgroup.test_replace_bucket_id_specified_twice = function(g) tuple[2] = bucket_id -- replace, opts.bucket_id is different - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers', tuple, {bucket_id = bucket_id + 1} }) @@ -385,7 +385,7 @@ pgroup.test_replace_bucket_id_specified_twice = function(g) t.assert_str_contains(err.err, 'Tuple and opts.bucket_id contain different bucket_id values') -- replace, opts.bucket_id is the same - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -404,7 +404,7 @@ pgroup.test_upsert_object = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- upsert_object - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', object, {}, }) @@ -422,7 +422,7 @@ pgroup.test_upsert_object_bucket_id_opt = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- upsert_object - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', object, {}, {bucket_id = bucket_id} }) @@ -441,7 +441,7 @@ pgroup.test_upsert_object_bucket_id_specified_twice = function(g) local tuple = crud_utils.flatten(object, g.space_format, bucket_id) -- upsert_object, opts.bucket_id is different - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', object, {}, {bucket_id = bucket_id + 1} }) @@ -449,7 +449,7 @@ pgroup.test_upsert_object_bucket_id_specified_twice = function(g) t.assert_str_contains(err.err, 'Tuple and opts.bucket_id contain different bucket_id values') -- upsert_object, opts.bucket_id is the same - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', object, {}, {bucket_id = bucket_id} }) @@ -466,7 +466,7 @@ pgroup.test_upsert = function(g) tuple[2] = bucket_id -- upsert - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', tuple, {}, {bucket_id = bucket_id} }) @@ -485,7 +485,7 @@ pgroup.test_upsert_bucket_id_opt = function(g) tuple_with_bucket_id[2] = bucket_id -- upsert - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', tuple, {}, {bucket_id = bucket_id} }) @@ -502,7 +502,7 @@ pgroup.test_upsert_bucket_id_specified_twice = function(g) tuple[2] = bucket_id -- upsert, opts.bucket_id is different - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', tuple, {}, {bucket_id = bucket_id + 1} }) @@ -510,7 +510,7 @@ pgroup.test_upsert_bucket_id_specified_twice = function(g) t.assert_str_contains(err.err, 'Tuple and opts.bucket_id contain different bucket_id values') -- upsert, opts.bucket_id is the same - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', tuple, {}, {bucket_id = bucket_id} }) @@ -526,7 +526,7 @@ pgroup.test_select = function(g) local bucket_id = get_other_storage_bucket_id(g, tuple[1]) -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', tuple, {bucket_id = bucket_id} }) @@ -537,7 +537,7 @@ pgroup.test_select = function(g) local conditions = {{'==', 'id', tuple[1]}} -- select w/ default bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, }) @@ -547,7 +547,7 @@ pgroup.test_select = function(g) t.assert_equals(#result.rows, 0) -- select w/ right bucket_id - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {bucket_id = bucket_id, mode = 'write'}, }) diff --git a/test/integration/ddl_sharding_func_test.lua b/test/integration/ddl_sharding_func_test.lua index 83feb299..dd67d899 100644 --- a/test/integration/ddl_sharding_func_test.lua +++ b/test/integration/ddl_sharding_func_test.lua @@ -28,7 +28,7 @@ local vshard_group = t.group('ddl_vshard_sharding_func', helpers.backend_matrix( local function before_all(g) helpers.start_default_cluster(g, 'srv_ddl') - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local ddl = require('ddl') local ok, err = ddl.get_schema() @@ -68,7 +68,7 @@ vshard_group.before_each(function(g) end) pgroup.test_insert_object = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {g.params.space_name, {id = 158, name = 'Augustus', age = 48}}) t.assert_equals(err, nil) @@ -94,7 +94,7 @@ end pgroup.test_insert = function(g) -- Insert a tuple. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert', {g.params.space_name, {27, box.NULL, 'Ivan', 25}}) t.assert_equals(err, nil) t.assert_equals(result.metadata, { @@ -118,7 +118,7 @@ pgroup.test_insert = function(g) end pgroup.test_insert_object_many = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object_many', {g.params.space_name, {{id = 158, name = 'Augustus', age = 48}}}) t.assert_equals(err, nil) @@ -144,7 +144,7 @@ end pgroup.test_insert_many = function(g) -- Insert a tuple. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_many', {g.params.space_name, {{27, box.NULL, 'Ivan', 25}}}) t.assert_equals(err, nil) t.assert_equals(result.metadata, { @@ -182,7 +182,7 @@ pgroup.test_replace_object = function(g) t.assert_not_equals(result, nil) -- Replace an object. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', {g.params.space_name, {id = 8, name = 'John Doe', age = 25}}) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) @@ -216,7 +216,7 @@ pgroup.test_replace = function(g) local tuple = {71, box.NULL, 'Augustus', 21} -- Replace a tuple. - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { g.params.space_name, tuple }) t.assert_equals(err, nil) @@ -250,7 +250,7 @@ pgroup.test_replace_object_many = function(g) t.assert_not_equals(result, nil) -- Replace an object. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object_many', {g.params.space_name, {{id = 8, name = 'John Doe', age = 25}}}) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) @@ -284,7 +284,7 @@ pgroup.test_replace_many = function(g) local tuple = {71, box.NULL, 'Augustus', 21} -- Replace a tuple. - local result, err = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, err = g.router:call('crud.replace_many', { g.params.space_name, {tuple} }) t.assert_equals(err, nil) @@ -305,7 +305,7 @@ end pgroup.test_upsert_object = function(g) -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {g.params.space_name, {id = 66, name = 'Jack Sparrow', age = 25}, {{'+', 'age', 26}}} ) @@ -329,7 +329,7 @@ pgroup.test_upsert_object = function(g) t.assert_equals(result, {66, 6, 'Jack Sparrow', 25}) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {g.params.space_name, {id = 66, name = 'Jack Sparrow', age = 25}, {{'+', 'age', 26}}} ) @@ -349,7 +349,7 @@ pgroup.test_upsert = function(g) local tuple = {14, box.NULL, 'John', 25} -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { g.params.space_name, tuple, {} }) t.assert_equals(err, nil) @@ -367,7 +367,7 @@ pgroup.test_upsert = function(g) t.assert_equals(result, {14, 4, 'John', 25}) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {g.params.space_name, {id = 14, name = 'John', age = 25}, {{'+', 'age', 26}}} ) @@ -385,7 +385,7 @@ end pgroup.test_upsert_object_many = function(g) -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object_many', {g.params.space_name, { { {id = 66, name = 'Jack Sparrow', age = 25}, {{'+', 'age', 26}} } }, } ) @@ -409,7 +409,7 @@ pgroup.test_upsert_object_many = function(g) t.assert_equals(result, {66, 6, 'Jack Sparrow', 25}) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object_many', {g.params.space_name, { { {id = 66, name = 'Jack Sparrow', age = 25}, {{'+', 'age', 26}} } }, } ) @@ -429,7 +429,7 @@ pgroup.test_upsert_many = function(g) local tuple = {14, box.NULL, 'John', 25} -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, err = g.router:call('crud.upsert_many', { g.params.space_name, { {tuple, {}} }, }) t.assert_equals(err, nil) @@ -447,7 +447,7 @@ pgroup.test_upsert_many = function(g) t.assert_equals(result, {14, 4, 'John', 25}) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_many', {g.params.space_name, { {tuple, {{'+', 'age', 26}}} }, } ) @@ -473,7 +473,7 @@ pgroup.test_select = function(g) t.assert_not_equals(result, nil) local conditions = {{'==', 'id', 18}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { g.params.space_name, conditions, {mode = 'write'}, }) @@ -493,7 +493,7 @@ pgroup.test_select = function(g) -- select will be performed on s2 replicaset -- but tuple is on s1 replicaset -> result will be empty local conditions = {{'==', 'id', 19}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { g.params.space_name, conditions, {mode = 'write'}, }) @@ -520,7 +520,7 @@ pgroup.test_update = function(g) local update_operations = { {'+', 'age', 10}, } - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { g.params.space_name, {12, 'Ivan'}, update_operations, }) t.assert_equals(err, nil) @@ -549,7 +549,7 @@ pgroup.test_update = function(g) -- calculated bucket_id will be id % 10 = 18 % 10 = 8 -> -- select will be performed on s2 replicaset -- but tuple is on s1 replicaset -> result will be empty - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { g.params.space_name, {18, 'Ivan'}, update_operations, }) t.assert_equals(err, nil) @@ -570,7 +570,7 @@ pgroup.test_get = function(g) t.assert_not_equals(result, nil) -- Get a tuple. - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { g.params.space_name, {12, 'Ivan'}, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -587,7 +587,7 @@ pgroup.test_get = function(g) -- calculated bucket_id will be id % 10 = 18 % 10 = 8 -> -- select will be performed on s2 replicaset -- but tuple is on s1 replicaset -> result will be empty - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { g.params.space_name, {18, 'Ivan'}, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -610,7 +610,7 @@ pgroup.test_delete = function(g) t.assert_not_equals(result, nil) -- Delete tuple. - local _, err = g.cluster.main_server.net_box:call('crud.delete', { + local _, err = g.router:call('crud.delete', { g.params.space_name, {12, 'Ivan'}, }) t.assert_equals(err, nil) @@ -633,7 +633,7 @@ pgroup.test_delete = function(g) -- calculated bucket_id will be id % 10 = 18 % 10 = 8 -> -- select will be performed on s2 replicaset -- but tuple is on s1 replicaset -> result will be empty - local _, err = g.cluster.main_server.net_box:call('crud.delete', { + local _, err = g.router:call('crud.delete', { g.params.space_name, {18, 'Ivan'} }) t.assert_equals(err, nil) @@ -653,7 +653,7 @@ pgroup.test_count = function(g) t.assert_not_equals(result, nil) local conditions = {{'==', 'id', 18}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { g.params.space_name, conditions, {mode = 'write'}, }) @@ -673,7 +673,7 @@ pgroup.test_count = function(g) -- but tuple is on s1 replicaset -> result will be empty -> -- count = 0 local conditions = {{'==', 'id', 19}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { g.params.space_name, conditions, {mode = 'write'}, }) @@ -837,7 +837,7 @@ for name, case in pairs(known_bucket_id_write_cases) do end pgroup[test_name] = function(g) - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( case.func, { g.params.space_name, case.input_2, @@ -876,7 +876,7 @@ for name, case in pairs(known_bucket_id_read_cases) do pgroup.before_test(test_name, prepare_known_bucket_id_data) pgroup[test_name] = function(g) - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( case.func, { g.params.space_name, case.input_2, @@ -893,7 +893,7 @@ pgroup.before_test( prepare_known_bucket_id_data) pgroup.test_gh_278_pairs_with_explicit_bucket_id_and_ddl = function(g) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local res = {} for _, row in crud.pairs(...) do table.insert(res, row) @@ -916,7 +916,7 @@ pgroup.before_test( prepare_known_bucket_id_data) pgroup.test_gh_278_count_with_explicit_bucket_id_and_ddl = function(g) - local obj, err = g.cluster.main_server.net_box:call('crud.count', { + local obj, err = g.router:call('crud.count', { g.params.space_name, {{ '==', 'id', known_bucket_id_key}}, {bucket_id = known_bucket_id, mode = 'write'}, @@ -980,7 +980,7 @@ for name, case in pairs(vshard_cases) do end -- Insert a tuple. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert', {space_name, {1, box.NULL, 'Ivan', 25}}) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) @@ -997,7 +997,7 @@ for name, case in pairs(vshard_cases) do t.assert_equals(result, nil) local conditions = {{'==', 'id', 1}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { space_name, conditions, {mode = 'write'}, }) diff --git a/test/integration/ddl_sharding_info_reload_test.lua b/test/integration/ddl_sharding_info_reload_test.lua index e0add7a8..a56b2d2b 100644 --- a/test/integration/ddl_sharding_info_reload_test.lua +++ b/test/integration/ddl_sharding_info_reload_test.lua @@ -64,7 +64,7 @@ pgroup_new_space.before_each(function(g) end) -- Fetch metadata schema. - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {0, box.NULL, 'Emma', 22}} ) @@ -72,7 +72,7 @@ pgroup_new_space.before_each(function(g) t.assert_equals(err, nil) -- Assert space doesn't exist. - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers_new', {1, box.NULL, 'Emma', 22}} ) @@ -90,7 +90,7 @@ pgroup_key_change.before_each(function(g) end) -- Assert schema is default: insert is sharded with default ddl info. - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {0, box.NULL, 'Emma', 22}} ) t.assert_is_not(obj, nil) @@ -116,7 +116,7 @@ pgroup_func_change.before_each(function(g) end) -- Assert schema is default: insert is sharded with default ddl info. - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers_pk', {0, box.NULL, 'Emma', 22}} ) t.assert_is_not(obj, nil) @@ -470,7 +470,7 @@ for name, case in pairs(new_space_cases) do end) -- Assert it is now possible to call opertions for a new space. - local obj, err = g.cluster.main_server.net_box:call(case.func, case.input) + local obj, err = g.router:call(case.func, case.input) t.assert_is_not(obj, nil) t.assert_equals(err, nil) @@ -584,7 +584,7 @@ for name, case in pairs(schema_change_sharding_key_cases) do end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call(case.func, case.input) + local obj, err = g.router:call(case.func, case.input) t.assert_is_not(obj, nil) t.assert_equals(err, nil) @@ -607,7 +607,7 @@ pgroup_key_change.test_select = function(g) end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.select', { 'customers', @@ -627,7 +627,7 @@ pgroup_key_change.test_count = function(g) end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.count', { 'customers', @@ -657,8 +657,8 @@ pgroup_key_change.test_pairs = function(g) -- First pairs request fails and reloads sharding info. t.assert_error_msg_contains( "Please retry your request", - g.cluster.main_server.net_box.eval, - g.cluster.main_server.net_box, + g.router.eval, + g.router, pairs_eval, { 'customers', @@ -667,7 +667,7 @@ pgroup_key_change.test_pairs = function(g) }) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:eval( + local obj, err = g.router:eval( pairs_eval, { 'customers', @@ -804,7 +804,7 @@ for name, case in pairs(schema_change_sharding_func_cases) do end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call(case.func, case.input) + local obj, err = g.router:call(case.func, case.input) t.assert_is_not(obj, nil) t.assert_equals(err, nil) @@ -828,7 +828,7 @@ pgroup_func_change.test_select = function(g) end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call('crud.select', { + local obj, err = g.router:call('crud.select', { 'customers_pk', {{'==', 'id', 1}}, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -845,7 +845,7 @@ pgroup_func_change.test_get = function(g) end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call('crud.get', { + local obj, err = g.router:call('crud.get', { 'customers_pk', 1, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -862,7 +862,7 @@ pgroup_func_change.test_count = function(g) end) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:call('crud.count', { + local obj, err = g.router:call('crud.count', { 'customers_pk', {{'==', 'id', 1}}, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -880,13 +880,13 @@ pgroup_func_change.test_pairs = function(g) t.assert_error_msg_contains( "Please retry your request", - g.cluster.main_server.net_box.eval, - g.cluster.main_server.net_box, + g.router.eval, + g.router, pairs_eval, {'customers_pk', {{'==', 'id', 1}}, {mode = 'write'}}) -- Assert operation bucket_id is computed based on updated ddl info. - local obj, err = g.cluster.main_server.net_box:eval( + local obj, err = g.router:eval( pairs_eval, {'customers_pk', {{'==', 'id', 1}}, {mode = 'write'}}) t.assert_equals(err, nil) diff --git a/test/integration/ddl_sharding_key_test.lua b/test/integration/ddl_sharding_key_test.lua index 0af41a74..239eb83c 100644 --- a/test/integration/ddl_sharding_key_test.lua +++ b/test/integration/ddl_sharding_key_test.lua @@ -17,7 +17,7 @@ local pgroup = t.group('ddl_sharding_key', helpers.backend_matrix({ pgroup.before_all(function(g) helpers.start_default_cluster(g, 'srv_ddl') - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local ddl = require('ddl') local ok, err = ddl.get_schema() @@ -26,7 +26,6 @@ pgroup.before_all(function(g) t.assert_equals(type(result), 'table') t.assert_equals(err, nil) - g.router = helpers.get_router(g.cluster, g.params.backend) g.router.net_box:eval([[ require('crud').cfg{ stats = true } ]]) @@ -48,7 +47,7 @@ pgroup.before_each(function(g) end) pgroup.test_insert_object = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'customers_name_key', {id = 1, name = 'Augustus', age = 48}}) t.assert_equals(err, nil) @@ -75,7 +74,7 @@ end pgroup.test_insert = function(g) -- Insert a tuple. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert', {'customers_name_key', {2, box.NULL, 'Ivan', 20}}) t.assert_equals(err, nil) t.assert_equals(result.metadata, { @@ -99,7 +98,7 @@ pgroup.test_insert = function(g) end pgroup.test_insert_object_many = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object_many', {'customers_name_key', {{id = 1, name = 'Augustus', age = 48}}}) t.assert_equals(err, nil) @@ -126,7 +125,7 @@ end pgroup.test_insert_many = function(g) -- Insert a tuple. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_many', {'customers_name_key', {{2, box.NULL, 'Ivan', 20}}}) t.assert_equals(err, nil) t.assert_equals(result.metadata, { @@ -166,7 +165,7 @@ pgroup.test_replace = function(g) local tuple = {7, box.NULL, 'Augustus', 21} -- Replace a tuple. - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers_name_key', tuple }) t.assert_equals(err, nil) @@ -200,7 +199,7 @@ pgroup.test_replace_object = function(g) t.assert_not_equals(result, nil) -- Replace an object. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', {'customers_name_key', {id = 8, name = 'John Doe', age = 25}}) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) @@ -234,7 +233,7 @@ pgroup.test_replace_many = function(g) local tuple = {7, box.NULL, 'Augustus', 21} -- Replace a tuple. - local result, err = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, err = g.router:call('crud.replace_many', { 'customers_name_key', {tuple} }) t.assert_equals(err, nil) @@ -268,7 +267,7 @@ pgroup.test_replace_object_many = function(g) t.assert_not_equals(result, nil) -- Replace an object. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object_many', {'customers_name_key', {{id = 8, name = 'John Doe', age = 25}}}) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) @@ -287,7 +286,7 @@ end pgroup.test_upsert_object = function(g) -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {'customers_name_key', {id = 66, name = 'Jack Sparrow', age = 25}, { {'+', 'age', 25}, }}) @@ -311,7 +310,7 @@ pgroup.test_upsert_object = function(g) t.assert_equals(result, nil) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {'customers_name_key', {id = 66, name = 'Jack Sparrow', age = 25}, { {'+', 'age', 25}, }}) @@ -331,7 +330,7 @@ pgroup.test_upsert = function(g) local tuple = {1, box.NULL, 'John', 25} -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers_name_key', tuple, {} }) t.assert_equals(err, nil) @@ -349,7 +348,7 @@ pgroup.test_upsert = function(g) t.assert_equals(result, nil) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {'customers_name_key', {id = 1, name = 'John', age = 25}, { {'+', 'age', 25}, }}) @@ -367,7 +366,7 @@ end pgroup.test_upsert_object_many = function(g) -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object_many', {'customers_name_key', { { {id = 66, name = 'Jack Sparrow', age = 25}, {{'+', 'age', 25}} } }, }) @@ -392,7 +391,7 @@ pgroup.test_upsert_object_many = function(g) t.assert_equals(result, nil) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object_many', {'customers_name_key', { {{id = 66, name = 'Jack Sparrow', age = 25}, {{'+', 'age', 25}}} }, }) @@ -412,7 +411,7 @@ pgroup.test_upsert_many = function(g) local tuple = {1, box.NULL, 'John', 25} -- Upsert an object first time. - local result, err = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, err = g.router:call('crud.upsert_many', { 'customers_name_key', { {tuple, {}} }, }) t.assert_equals(err, nil) @@ -430,7 +429,7 @@ pgroup.test_upsert_many = function(g) t.assert_equals(result, nil) -- Upsert the same query second time when tuple exists. - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_many', {'customers_name_key', { {tuple, {{'+', 'age', 25}}} }, }) t.assert_equals(result.rows, nil) t.assert_equals(err, nil) @@ -462,7 +461,7 @@ pgroup.test_select = function(g) t.assert_not_equals(result, nil) local conditions = {{'==', 'name', 'Ptolemy'}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers_name_key', conditions, {mode = 'write'}, }) @@ -481,7 +480,7 @@ pgroup.test_count = function(g) t.assert_not_equals(result, nil) local conditions = {{'==', 'name', 'Ptolemy'}} - local result, err = g.cluster.main_server.net_box:call('crud.count', { + local result, err = g.router:call('crud.count', { 'customers_name_key', conditions, {mode = 'write'} }) @@ -596,7 +595,7 @@ pgroup.test_select_secondary_idx = function(g) local tuple = {2, box.NULL, 'Ivan', 20} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_secondary_idx_name_key', tuple }) @@ -606,7 +605,7 @@ pgroup.test_select_secondary_idx = function(g) local conditions = {{'==', 'name', 'Ivan'}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers_secondary_idx_name_key', conditions, {mode = 'write'}, }) @@ -633,7 +632,7 @@ pgroup.test_select_non_unique_index = function(g) }) t.assert_equals(#customers, 10) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { space_name, {{'==', 'name', 'Ivan Bunin'}}, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -660,7 +659,7 @@ pgroup.test_update = function(g) local update_operations = { {'+', 'age', 10}, } - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers_name_key', {2, 'Ivan'}, update_operations, }) t.assert_equals(err, nil) @@ -686,7 +685,7 @@ pgroup.test_get = function(g) t.assert_not_equals(result, nil) -- Get a tuple. - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers_name_key', {7, 'Dimitrion'}, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -709,7 +708,7 @@ pgroup.test_delete = function(g) t.assert_not_equals(result, nil) -- Delete tuple. - local _, err = g.cluster.main_server.net_box:call('crud.delete', { + local _, err = g.router:call('crud.delete', { 'customers_name_key', {7, 'Dimitrion'}, }) t.assert_equals(err, nil) @@ -727,7 +726,7 @@ pgroup.test_delete_incomplete_sharding_key = function(g) local tuple = {2, box.NULL, 'Viktor Pelevin', 58} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_age_key', tuple }) @@ -735,7 +734,7 @@ pgroup.test_delete_incomplete_sharding_key = function(g) t.assert_not_equals(result, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:call('crud.delete', { + local result, err = g.router:call('crud.delete', { 'customers_age_key', {58, 'Viktor Pelevin'} }) @@ -748,7 +747,7 @@ pgroup.test_get_incomplete_sharding_key = function(g) local tuple = {2, box.NULL, 'Viktor Pelevin', 58} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_age_key', tuple }) @@ -756,7 +755,7 @@ pgroup.test_get_incomplete_sharding_key = function(g) t.assert_not_equals(result, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers_age_key', {58, 'Viktor Pelevin'}, {mode = 'write'}, }) @@ -769,7 +768,7 @@ pgroup.test_update_incomplete_sharding_key = function(g) local tuple = {2, box.NULL, 'Viktor Pelevin', 58} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_age_key', tuple }) @@ -781,7 +780,7 @@ pgroup.test_update_incomplete_sharding_key = function(g) {'=', 'age', 60}, } - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers_age_key', {2, 'Viktor Pelevin'}, update_operations, }) @@ -794,7 +793,7 @@ pgroup.test_get_secondary_idx = function(g) local tuple = {4, box.NULL, 'Leo', 44} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_secondary_idx_name_key', tuple }) @@ -803,7 +802,7 @@ pgroup.test_get_secondary_idx = function(g) t.assert_equals(#result.rows, 1) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', + local result, err = g.router:call('crud.get', {'customers_secondary_idx_name_key', {4, 'Leo'}, {mode = 'write'}, }) @@ -816,7 +815,7 @@ pgroup.test_update_secondary_idx = function(g) local tuple = {6, box.NULL, 'Victor', 58} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_secondary_idx_name_key', tuple }) @@ -828,7 +827,7 @@ pgroup.test_update_secondary_idx = function(g) {'=', 'age', 58}, } - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers_secondary_idx_name_key', {6, 'Victor'}, update_operations, }) @@ -841,7 +840,7 @@ pgroup.test_delete_secondary_idx = function(g) local tuple = {8, box.NULL, 'Alexander', 37} -- insert tuple - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers_secondary_idx_name_key', tuple }) @@ -849,7 +848,7 @@ pgroup.test_delete_secondary_idx = function(g) t.assert_not_equals(result, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:call('crud.delete', { + local result, err = g.router:call('crud.delete', { 'customers_secondary_idx_name_key', {8, 'Alexander'} }) @@ -1088,7 +1087,7 @@ for name, case in pairs(known_bucket_id_write_cases) do end pgroup[test_name] = function(g) - local obj, err = g.cluster.main_server.net_box:call(case.func, case.input) + local obj, err = g.router:call(case.func, case.input) t.assert_equals(err, nil) t.assert_is_not(obj, nil) @@ -1127,7 +1126,7 @@ for name, case in pairs(known_bucket_id_read_cases) do pgroup.before_test(test_name, prepare_known_bucket_id_data) pgroup[test_name] = function(g) - local obj, err = g.cluster.main_server.net_box:call(case.func, case.input) + local obj, err = g.router:call(case.func, case.input) t.assert_equals(err, nil) t.assert_is_not(obj, nil) t.assert_equals(obj.rows, {known_bucket_id_result_tuple}) @@ -1139,7 +1138,7 @@ pgroup.before_test( prepare_known_bucket_id_data) pgroup.test_gh_278_pairs_with_explicit_bucket_id_and_ddl = function(g) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local res = {} for _, row in crud.pairs(...) do table.insert(res, row) @@ -1162,7 +1161,7 @@ pgroup.before_test( prepare_known_bucket_id_data) pgroup.test_gh_278_count_with_explicit_bucket_id_and_ddl = function(g) - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.count', { known_bucket_id_space, diff --git a/test/integration/insert_many_test.lua b/test/integration/insert_many_test.lua index c8a73cfb..03c71d16 100644 --- a/test/integration/insert_many_test.lua +++ b/test/integration/insert_many_test.lua @@ -24,7 +24,7 @@ end) pgroup.test_non_existent_space = function(g) -- insert_many - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'non_existent_space', { {1, box.NULL, 'Alex', 59}, @@ -40,7 +40,7 @@ pgroup.test_non_existent_space = function(g) -- insert_object_many -- default: stop_on_error == false - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'non_existent_space', { {id = 1, name = 'Fedor', age = 59}, @@ -60,7 +60,7 @@ pgroup.test_non_existent_space = function(g) -- insert_object_many -- stop_on_error == true - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'non_existent_space', { {id = 1, name = 'Fedor', age = 59}, @@ -82,7 +82,7 @@ end pgroup.test_object_bad_format = function(g) -- bad format - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Fedor', age = 59}, @@ -114,7 +114,7 @@ pgroup.test_object_bad_format = function(g) t.assert_equals(result, {1, 477, 'Fedor', 59}) -- bad format - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Fedor', age = 59}, @@ -140,7 +140,7 @@ pgroup.test_object_bad_format = function(g) -- bad format -- two errors, default: stop_on_error == false - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Fedor'}, @@ -164,7 +164,7 @@ end pgroup.test_all_success = function(g) -- insert_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -208,7 +208,7 @@ end pgroup.test_object_all_success = function(g) -- batch_insert_object -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Fedor', age = 59}, @@ -259,7 +259,7 @@ pgroup.test_one_error = function(g) -- insert_many -- default: stop_on_error = false, rollback_on_error = false -- one error on one storage without rollback - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {22, box.NULL, 'Alex', 34}, @@ -319,7 +319,7 @@ pgroup.test_object_one_error = function(g) -- batch_insert_object again -- default: stop_on_error = false, rollback_on_error = false -- one error on one storage without rollback - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 22, name = 'Alex', age = 34}, @@ -384,7 +384,7 @@ pgroup.test_many_errors = function(g) -- insert_many -- fails for both: s1-master s2-master -- one error on each storage, one success on each storage - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {2, box.NULL, 'Alex', 34}, @@ -454,7 +454,7 @@ pgroup.test_object_many_errors = function(g) -- batch_insert_object again -- fails for both: s1-master s2-master -- one error on each storage, one success on each storage - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 2, name = 'Alex', age = 34}, @@ -534,7 +534,7 @@ pgroup.test_no_success = function(g) -- insert_many again -- fails for both: s1-master s2-master -- no success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {2, box.NULL, 'Alex', 34}, @@ -608,7 +608,7 @@ pgroup.test_object_no_success = function(g) -- batch_insert_object again -- fails for both: s1-master s2-master -- no success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 2, name = 'Alex', age = 34}, @@ -660,7 +660,7 @@ end pgroup.test_object_bad_format_stop_on_error = function(g) -- bad format -- two errors, stop_on_error == true - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Fedor'}, @@ -682,7 +682,7 @@ end pgroup.test_all_success_stop_on_error = function(g) -- insert_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {2, box.NULL, 'Anna', 23}, @@ -729,7 +729,7 @@ end pgroup.test_object_all_success_stop_on_error = function(g) -- batch_insert_object -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 2, name = 'Anna', age = 23}, @@ -789,7 +789,7 @@ pgroup.test_partial_success_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = false -- one error on one storage without rollback, inserts stop by error on this storage -- inserts before error are successful - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {22, box.NULL, 'Alex', 34}, @@ -871,7 +871,7 @@ pgroup.test_object_partial_success_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = false -- one error on one storage without rollback, inserts stop by error on this storage -- inserts before error are successful - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 22, name = 'Alex', age = 34}, @@ -957,7 +957,7 @@ pgroup.test_no_success_stop_on_error = function(g) -- insert_many -- fails for both: s1-master s2-master -- one error on each storage, all inserts stop by error - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {2, box.NULL, 'Alex', 34}, @@ -1038,7 +1038,7 @@ pgroup.test_object_no_success_stop_on_error = function(g) -- insert_object_many -- fails for both: s1-master s2-master -- one error on each storage, all inserts stop by error - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 2, name = 'Alex', age = 34}, @@ -1102,7 +1102,7 @@ end pgroup.test_all_success_rollback_on_error = function(g) -- insert_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {2, box.NULL, 'Anna', 23}, @@ -1149,7 +1149,7 @@ end pgroup.test_object_all_success_rollback_on_error = function(g) -- insert_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 2, name = 'Anna', age = 23}, @@ -1208,7 +1208,7 @@ pgroup.test_partial_success_rollback_on_error = function(g) -- insert_many -- stop_on_error = false, rollback_on_error = true -- two error on one storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {22, box.NULL, 'Alex', 34}, @@ -1291,7 +1291,7 @@ pgroup.test_object_partial_success_rollback_on_error = function(g) -- insert_object_many -- stop_on_error = false, rollback_on_error = true -- two error on one storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 22, name = 'Alex', age = 34}, @@ -1384,7 +1384,7 @@ pgroup.test_no_success_rollback_on_error = function(g) -- insert_many -- fails for both: s1-master s2-master -- two errors on each storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {1, box.NULL, 'Olga', 27}, @@ -1479,7 +1479,7 @@ pgroup.test_object_no_success_rollback_on_error = function(g) -- insert_object_many -- fails for both: s1-master s2-master -- two errors on each storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Olga', age = 27}, @@ -1552,7 +1552,7 @@ end pgroup.test_all_success_rollback_and_stop_on_error = function(g) -- insert_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {2, box.NULL, 'Anna', 23}, @@ -1600,7 +1600,7 @@ end pgroup.test_object_all_success_rollback_and_stop_on_error = function(g) -- insert_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 2, name = 'Anna', age = 23}, @@ -1661,7 +1661,7 @@ pgroup.test_partial_success_rollback_and_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = true -- two error on one storage with rollback, inserts stop by error on this storage -- inserts before error are rollbacked - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {22, box.NULL, 'Alex', 34}, @@ -1755,7 +1755,7 @@ pgroup.test_object_partial_success_rollback_and_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = true -- two error on one storage with rollback, inserts stop by error on this storage -- inserts before error are rollbacked - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 22, name = 'Alex', age = 34}, @@ -1835,7 +1835,7 @@ end pgroup.test_partial_result = function(g) -- bad fields format - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {15, box.NULL, 'Fedor', 59}, @@ -1850,7 +1850,7 @@ pgroup.test_partial_result = function(g) t.assert_str_contains(errs[1].err, 'Space format doesn\'t contain field named "invalid"') -- insert_many - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -1872,7 +1872,7 @@ end pgroup.test_object_partial_result = function(g) -- bad fields format - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 15, name = 'Fedor', age = 59}, @@ -1887,7 +1887,7 @@ pgroup.test_object_partial_result = function(g) t.assert_str_contains(errs[1].err, 'Space format doesn\'t contain field named "invalid"') -- insert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 1, name = 'Fedor', age = 59}, @@ -1910,7 +1910,7 @@ end pgroup.test_opts_not_damaged = function(g) -- insert_many local batch_insert_opts = {timeout = 1, fields = {'name', 'age'}} - local new_batch_insert_opts, err = g.cluster.main_server:eval([[ + local new_batch_insert_opts, err = g.router:eval([[ local crud = require('crud') local batch_insert_opts = ... @@ -1927,7 +1927,7 @@ pgroup.test_opts_not_damaged = function(g) -- insert_object_many local batch_insert_opts = {timeout = 1, fields = {'name', 'age'}} - local new_batch_insert_opts, err = g.cluster.main_server:eval([[ + local new_batch_insert_opts, err = g.router:eval([[ local crud = require('crud') local batch_insert_opts = ... @@ -1945,7 +1945,7 @@ end pgroup.test_noreturn_opt = function(g) -- insert_many with noreturn, all tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -1959,7 +1959,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- insert_many with noreturn, some tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -1974,7 +1974,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- insert_many with noreturn, all tuples are not correct - local result, errs = g.cluster.main_server.net_box:call('crud.insert_many', { + local result, errs = g.router:call('crud.insert_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -1989,7 +1989,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- insert_object_many with noreturn, all tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 10, name = 'Fedor', age = 59}, @@ -2003,7 +2003,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- insert_object_many with noreturn, some tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = 40, name = 'Fedor', age = 59}, @@ -2018,7 +2018,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- insert_object_many with noreturn, all tuples are not correct - local result, errs = g.cluster.main_server.net_box:call('crud.insert_object_many', { + local result, errs = g.router:call('crud.insert_object_many', { 'customers', { {id = box.NULL, name = 'Fedor', age = 59}, @@ -2034,7 +2034,7 @@ pgroup.test_noreturn_opt = function(g) end pgroup.test_zero_tuples = function(g) - local result, errs = g.cluster.main_server.net_box:call( + local result, errs = g.router:call( 'crud.insert_many', {'customers', {}}) t.assert_not_equals(errs, nil) @@ -2044,7 +2044,7 @@ pgroup.test_zero_tuples = function(g) end pgroup.test_zero_objects = function(g) - local result, errs = g.cluster.main_server.net_box:call( + local result, errs = g.router:call( 'crud.insert_object_many', {'customers', {}}) t.assert_not_equals(errs, nil) diff --git a/test/integration/len_test.lua b/test/integration/len_test.lua index a28fd397..19f71548 100644 --- a/test/integration/len_test.lua +++ b/test/integration/len_test.lua @@ -19,7 +19,7 @@ pgroup.before_each(function(g) end) pgroup.test_len_non_existent_space = function(g) - local result, err = g.cluster.main_server.net_box:call('crud.len', {'non_existent_space'}) + local result, err = g.router:call('crud.len', {'non_existent_space'}) t.assert_equals(result, nil) t.assert_str_contains(err.err, "Space \"non_existent_space\" doesn't exist") @@ -40,14 +40,14 @@ pgroup.test_len = function(g) helpers.insert_objects(g, 'customers', customers) - local result, err = g.cluster.main_server.net_box:call('crud.len', {'customers'}) + local result, err = g.router:call('crud.len', {'customers'}) t.assert_equals(err, nil) t.assert_equals(result, expected_len) end pgroup.test_len_empty_space = function(g) - local result, err = g.cluster.main_server.net_box:call('crud.len', {'customers'}) + local result, err = g.router:call('crud.len', {'customers'}) t.assert_equals(err, nil) t.assert_equals(result, 0) @@ -55,7 +55,7 @@ end pgroup.test_opts_not_damaged = function(g) local len_opts = {timeout = 1} - local new_len_opts, err = g.cluster.main_server:eval([[ + local new_len_opts, err = g.router:eval([[ local crud = require('crud') local len_opts = ... diff --git a/test/integration/migration_test.lua b/test/integration/migration_test.lua index 95a059d5..82539e33 100644 --- a/test/integration/migration_test.lua +++ b/test/integration/migration_test.lua @@ -51,7 +51,7 @@ pgroup.test_gh_308_select_after_improper_ddl_space_drop = function(g) end) -- Ensure that crud request for existing space is ok. - local _, err = g.cluster.main_server.net_box:call('crud.select', { + local _, err = g.router:call('crud.select', { 'customers', nil, {first = 1, mode = 'write'}, }) t.assert_equals(err, nil) diff --git a/test/integration/pairs_readview_test.lua b/test/integration/pairs_readview_test.lua index f3bb7085..9905c412 100644 --- a/test/integration/pairs_readview_test.lua +++ b/test/integration/pairs_readview_test.lua @@ -19,7 +19,7 @@ pgroup.before_all(function(g) g.space_format = g.cluster.servers[2].net_box.space.customers:format() - g.cluster.main_server.net_box:eval([[ + g.router:eval([[ require('crud').cfg{ stats = true } ]]) end) @@ -60,7 +60,7 @@ pgroup.test_pairs_no_conditions = function(g) } -- without conditions and options - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -77,7 +77,7 @@ pgroup.test_pairs_no_conditions = function(g) t.assert_equals(objects, raw_rows) -- with use_tomap=false (the raw tuples returned) - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -95,7 +95,7 @@ pgroup.test_pairs_no_conditions = function(g) t.assert_equals(objects, raw_rows) -- no after - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -114,7 +114,7 @@ pgroup.test_pairs_no_conditions = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local after = ... @@ -136,7 +136,7 @@ pgroup.test_pairs_no_conditions = function(g) -- after obj 4 (last) local after = crud_utils.flatten(customers[4], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local after = ... @@ -181,7 +181,7 @@ pgroup.test_ge_condition_with_index = function(g) } -- no after - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -204,7 +204,7 @@ pgroup.test_ge_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -249,7 +249,7 @@ pgroup.test_le_condition_with_index = function(g) } -- no after - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -270,7 +270,7 @@ pgroup.test_le_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -308,7 +308,7 @@ pgroup.test_first = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- w/ tomap - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local objects = {} local foo, err = crud.readview({name = 'foo'}) @@ -324,7 +324,7 @@ pgroup.test_first = function(g) t.assert_equals(err, nil) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {1, 2})) - local tuples, err = g.cluster.main_server.net_box:eval([[ + local tuples, err = g.router:eval([[ local crud = require('crud') local tuples = {} local foo, err = crud.readview({name = 'foo'}) @@ -362,7 +362,7 @@ pgroup.test_negative_first = function(g) -- negative first t.assert_error_msg_contains("Negative first isn't allowed for pairs", function() - g.cluster.main_server.net_box:eval([[ + g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -375,7 +375,7 @@ pgroup.test_negative_first = function(g) end pgroup.test_empty_space = function(g) - local count = g.cluster.main_server.net_box:eval([[ + local count = g.router:eval([[ local crud = require('crud') local count = 0 local foo, err = crud.readview({name = 'foo'}) @@ -404,7 +404,7 @@ pgroup.test_luafun_compatibility = function(g) age = 33, city = "Los Angeles", }, }) - local count = g.cluster.main_server.net_box:eval([[ + local count = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -416,7 +416,7 @@ pgroup.test_luafun_compatibility = function(g) ]]) t.assert_equals(count, 3) - count = g.cluster.main_server.net_box:eval([[ + count = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -461,7 +461,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -485,7 +485,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -519,7 +519,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -543,7 +543,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -580,7 +580,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", age = 33}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -604,7 +604,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", age = 33}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -639,7 +639,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -665,7 +665,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -693,7 +693,7 @@ end pgroup.test_pairs_force_map_call = function(g) local key = 1 - local first_bucket_id = g.cluster.main_server.net_box:eval([[ + local first_bucket_id = g.router:eval([[ local vshard = require('vshard') local key = ... @@ -718,7 +718,7 @@ pgroup.test_pairs_force_map_call = function(g) local conditions = {{'==', 'id', key}} - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -739,7 +739,7 @@ pgroup.test_pairs_force_map_call = function(g) t.assert_equals(err, nil) t.assert_equals(#objects, 1) - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -786,7 +786,7 @@ pgroup.test_pairs_timeout = function(g) {4, 1161, 'William', 'White', 81, 'Chicago'}, } - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -829,7 +829,7 @@ pgroup.test_pairs_no_map_reduce = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local router = helpers.get_router(g.cluster, g.params.backend).net_box + local router = g.router local map_reduces_before = helpers.get_map_reduces_stat(router, 'customers') -- Case: no conditions, just bucket id. @@ -858,7 +858,7 @@ pgroup.test_pairs_no_map_reduce = function(g) -- Case: EQ on secondary index, which is not in the sharding -- index (primary index in the case). - local rows = g.cluster.main_server.net_box:eval([[ + local rows = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then diff --git a/test/integration/pairs_test.lua b/test/integration/pairs_test.lua index 38bb3bf9..4d47163f 100644 --- a/test/integration/pairs_test.lua +++ b/test/integration/pairs_test.lua @@ -14,7 +14,7 @@ pgroup.before_all(function(g) g.space_format = g.cluster:server('s1-master').net_box.space.customers:format() - g.cluster.main_server.net_box:eval([[ + g.router:eval([[ require('crud').cfg{ stats = true } ]]) end) @@ -55,7 +55,7 @@ pgroup.test_pairs_no_conditions = function(g) } -- without conditions and options - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -68,7 +68,7 @@ pgroup.test_pairs_no_conditions = function(g) t.assert_equals(objects, raw_rows) -- with use_tomap=false (the raw tuples returned) - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -81,7 +81,7 @@ pgroup.test_pairs_no_conditions = function(g) t.assert_equals(objects, raw_rows) -- no after - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -96,7 +96,7 @@ pgroup.test_pairs_no_conditions = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local after = ... @@ -114,7 +114,7 @@ pgroup.test_pairs_no_conditions = function(g) -- after obj 4 (last) local after = crud_utils.flatten(customers[4], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local after = ... @@ -155,7 +155,7 @@ pgroup.test_ge_condition_with_index = function(g) } -- no after - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -173,7 +173,7 @@ pgroup.test_ge_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -214,7 +214,7 @@ pgroup.test_le_condition_with_index = function(g) } -- no after - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -232,7 +232,7 @@ pgroup.test_le_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -266,7 +266,7 @@ pgroup.test_first = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- w/ tomap - local objects, err = g.cluster.main_server.net_box:eval([[ + local objects, err = g.router:eval([[ local crud = require('crud') local objects = {} for _, object in crud.pairs('customers', nil, {first = 2, use_tomap = true, mode = 'write'}) do @@ -277,7 +277,7 @@ pgroup.test_first = function(g) t.assert_equals(err, nil) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {1, 2})) - local tuples, err = g.cluster.main_server.net_box:eval([[ + local tuples, err = g.router:eval([[ local crud = require('crud') local tuples = {} for _, tuple in crud.pairs('customers', nil, {first = 2}) do @@ -310,7 +310,7 @@ pgroup.test_negative_first = function(g) -- negative first t.assert_error_msg_contains("Negative first isn't allowed for pairs", function() - g.cluster.main_server.net_box:eval([[ + g.router:eval([[ local crud = require('crud') crud.pairs('customers', nil, {first = -10}) ]]) @@ -318,7 +318,7 @@ pgroup.test_negative_first = function(g) end pgroup.test_empty_space = function(g) - local count = g.cluster.main_server.net_box:eval([[ + local count = g.router:eval([[ local crud = require('crud') local count = 0 for _, object in crud.pairs('customers', nil, {mode = 'write'}) do @@ -342,14 +342,14 @@ pgroup.test_luafun_compatibility = function(g) age = 33, city = "Los Angeles", }, }) - local count = g.cluster.main_server.net_box:eval([[ + local count = g.router:eval([[ local crud = require('crud') local count = crud.pairs('customers', nil, {mode = 'write'}):map(function() return 1 end):sum() return count ]]) t.assert_equals(count, 3) - count = g.cluster.main_server.net_box:eval([[ + count = g.router:eval([[ local crud = require('crud') local count = crud.pairs( 'customers', @@ -392,7 +392,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -412,7 +412,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -446,7 +446,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -466,7 +466,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -503,7 +503,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", age = 33}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -523,7 +523,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", age = 33}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -557,7 +557,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -577,7 +577,7 @@ pgroup.test_pairs_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -632,7 +632,7 @@ pgroup.test_pairs_cut_result = function(g) {name = "William", city = "Chicago"}, } - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -653,7 +653,7 @@ pgroup.test_pairs_cut_result = function(g) {"William", "Chicago"}, } - local tuples = g.cluster.main_server.net_box:eval([[ + local tuples = g.router:eval([[ local crud = require('crud') local conditions, fields = ... @@ -672,7 +672,7 @@ end pgroup.test_pairs_force_map_call = function(g) local key = 1 - local first_bucket_id = g.cluster.main_server.net_box:eval([[ + local first_bucket_id = g.router:eval([[ local vshard = require('vshard') local key = ... @@ -697,7 +697,7 @@ pgroup.test_pairs_force_map_call = function(g) local conditions = {{'==', 'id', key}} - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -713,7 +713,7 @@ pgroup.test_pairs_force_map_call = function(g) t.assert_equals(err, nil) t.assert_equals(#objects, 1) - objects = g.cluster.main_server.net_box:eval([[ + objects = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -759,7 +759,7 @@ pgroup.test_pairs_timeout = function(g) {4, 1161, 'William', 'White', 81, 'Chicago'}, } - local objects = g.cluster.main_server.net_box:eval([[ + local objects = g.router:eval([[ local crud = require('crud') local objects = {} @@ -809,7 +809,7 @@ pgroup.test_opts_not_damaged = function(g) fields = fields, mode = 'write', prefer_replica = false, balance = false, force_map_call = false, use_tomap = true, } - local new_pairs_opts, objects = g.cluster.main_server:eval([[ + local new_pairs_opts, objects = g.router:eval([[ local crud = require('crud') local pairs_opts = ... @@ -851,7 +851,7 @@ pgroup.test_pairs_no_map_reduce = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local router = helpers.get_router(g.cluster, g.params.backend).net_box + local router = g.router local map_reduces_before = helpers.get_map_reduces_stat(router, 'customers') -- Case: no conditions, just bucket id. @@ -874,7 +874,7 @@ pgroup.test_pairs_no_map_reduce = function(g) -- Case: EQ on secondary index, which is not in the sharding -- index (primary index in the case). - local rows = g.cluster.main_server.net_box:eval([[ + local rows = g.router:eval([[ local crud = require('crud') return crud.pairs(...):totable() diff --git a/test/integration/read_calls_strategies_test.lua b/test/integration/read_calls_strategies_test.lua index eec8606f..1373271b 100644 --- a/test/integration/read_calls_strategies_test.lua +++ b/test/integration/read_calls_strategies_test.lua @@ -29,7 +29,7 @@ local pgroup = t.group('read_calls_strategies', helpers.backend_matrix({ pgroup.before_all(function(g) helpers.start_default_cluster(g, 'srv_read_calls_strategies') - g.space_format = g.cluster.servers[2].net_box.space.customers:format() + g.space_format = g.cluster:server('s1-master').net_box.space.customers:format() g.clear_vshard_calls = function() g.cluster.main_server.net_box:call('clear_vshard_calls') diff --git a/test/integration/readview_not_supported_test.lua b/test/integration/readview_not_supported_test.lua index fdada756..712f21a4 100644 --- a/test/integration/readview_not_supported_test.lua +++ b/test/integration/readview_not_supported_test.lua @@ -23,7 +23,7 @@ pgroup.after_all(function(g) end) pgroup.test_open = function(g) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) return foo, err diff --git a/test/integration/replace_many_test.lua b/test/integration/replace_many_test.lua index 6b8c75aa..9783dd02 100644 --- a/test/integration/replace_many_test.lua +++ b/test/integration/replace_many_test.lua @@ -25,7 +25,7 @@ end) pgroup.test_non_existent_space = function(g) -- replace_many - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'non_existent_space', { {1, box.NULL, 'Alex', 'alexpushkin'}, @@ -41,7 +41,7 @@ pgroup.test_non_existent_space = function(g) -- replace_object_many -- default: stop_on_error == false - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'non_existent_space', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -61,7 +61,7 @@ pgroup.test_non_existent_space = function(g) -- replace_object_many -- stop_on_error == true - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'non_existent_space', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -83,7 +83,7 @@ end pgroup.test_object_bad_format = function(g) -- bad format - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -115,7 +115,7 @@ pgroup.test_object_bad_format = function(g) t.assert_equals(result, {1, 477, 'Fedor', 'FDost'}) -- bad format - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 4, name = 'Fedor', login = 'FDost'}, @@ -141,7 +141,7 @@ pgroup.test_object_bad_format = function(g) -- bad format -- two errors, default: stop_on_error == false - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor'}, @@ -165,7 +165,7 @@ end pgroup.test_all_success = function(g) -- replace_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Fedor', 'FDost'}, @@ -215,7 +215,7 @@ pgroup.test_object_all_success = function(g) -- replace_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -265,7 +265,7 @@ pgroup.test_one_error = function(g) -- replace_many -- failed for s1-master - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {4, box.NULL, 'Fedor', 'alexpushkin'}, @@ -318,7 +318,7 @@ pgroup.test_object_one_error = function(g) -- replace_object_many -- failed for s1-master - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 4, name = 'Fedor', login = 'alexpushkin'}, @@ -377,7 +377,7 @@ pgroup.test_object_many_errors = function(g) -- replace_object_many -- fails for both: s1-master s2-master -- one error on each storage, one success on each storage - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 4, name = 'Sergey', login = 's.ivanov'}, @@ -447,7 +447,7 @@ pgroup.test_many_errors = function(g) -- replace_many -- fails for both: s1-master s2-master -- one error on each storage, one success on each storage - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {4, box.NULL, 'Sergey', 's.ivanov'}, @@ -527,7 +527,7 @@ pgroup.test_no_success = function(g) -- replace_many -- fails for both: s1-master s2-master -- no success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {4, box.NULL, 'Alex', 'a.smith'}, @@ -601,7 +601,7 @@ pgroup.test_object_no_success = function(g) -- replace_object_many -- fails for both: s1-master s2-master -- no success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 4, name = 'Alex', login = 'a.smith'}, @@ -653,7 +653,7 @@ end pgroup.test_object_bad_format_stop_on_error = function(g) -- bad format -- two errors, stop_on_error == true - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor'}, @@ -675,7 +675,7 @@ end pgroup.test_all_success_stop_on_error = function(g) -- replace_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Fedor', 'FDost'}, @@ -728,7 +728,7 @@ pgroup.test_object_all_success_stop_on_error = function(g) -- replace_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -788,7 +788,7 @@ pgroup.test_partial_success_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = false -- one error on one storage without rollback, inserts stop by error on this storage -- inserts before error are successful - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {22, box.NULL, 'Alex', 'alexpushkin'}, @@ -870,7 +870,7 @@ pgroup.test_object_partial_success_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = false -- one error on one storage without rollback, inserts stop by error on this storage -- inserts before error are successful - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 22, name = 'Alex', login = 'alexpushkin'}, @@ -956,7 +956,7 @@ pgroup.test_no_success_stop_on_error = function(g) -- replace_many -- fails for both: s1-master s2-master -- one error on each storage, all inserts stop by error - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {71, box.NULL, 'Alex', 'AGolden'}, @@ -1037,7 +1037,7 @@ pgroup.test_object_no_success_stop_on_error = function(g) -- replace_object_many -- fails for both: s1-master s2-master -- one error on each storage, all inserts stop by error - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 71, name = 'Alex', login = 'AGolden'}, @@ -1101,7 +1101,7 @@ end pgroup.test_all_success_rollback_on_error = function(g) -- replace_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Fedor', 'FDost'}, @@ -1154,7 +1154,7 @@ pgroup.test_object_all_success_rollback_on_error = function(g) -- replace_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -1213,7 +1213,7 @@ pgroup.test_partial_success_rollback_on_error = function(g) -- replace_many -- stop_on_error = false, rollback_on_error = true -- two error on one storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {22, box.NULL, 'Alex', 'alexpushkin'}, @@ -1296,7 +1296,7 @@ pgroup.test_object_partial_success_rollback_on_error = function(g) -- replace_object_many -- stop_on_error = false, rollback_on_error = true -- two error on one storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 22, name = 'Alex', login = 'alexpushkin'}, @@ -1389,7 +1389,7 @@ pgroup.test_no_success_rollback_on_error = function(g) -- replace_many -- fails for both: s1-master s2-master -- two errors on each storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Eren', 'e.eger'}, @@ -1484,7 +1484,7 @@ pgroup.test_object_no_success_rollback_on_error = function(g) -- replace_object_many -- fails for both: s1-master s2-master -- two errors on each storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Eren', login = 'e.eger'}, @@ -1557,7 +1557,7 @@ end pgroup.test_all_success_rollback_and_stop_on_error = function(g) -- replace_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Fedor', 'FDost'}, @@ -1611,7 +1611,7 @@ pgroup.test_object_all_success_rollback_and_stop_on_error = function(g) -- replace_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -1672,7 +1672,7 @@ pgroup.test_partial_success_rollback_and_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = true -- two error on one storage with rollback, inserts stop by error on this storage -- inserts before error are rollbacked - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {22, box.NULL, 'Alex', 'alexpushkin'}, @@ -1766,7 +1766,7 @@ pgroup.test_object_partial_success_rollback_and_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = true -- two error on one storage with rollback, inserts stop by error on this storage -- inserts before error are rollbacked - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 22, name = 'Alex', login = 'alexpushkin'}, @@ -1846,7 +1846,7 @@ end pgroup.test_partial_result = function(g) -- bad fields format - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Fedor', 'FDost'}, @@ -1861,7 +1861,7 @@ pgroup.test_partial_result = function(g) t.assert_str_contains(errs[1].err, 'Space format doesn\'t contain field named "invalid"') -- replace_many - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'developers', { {1, box.NULL, 'Fedor', 'FDost'}, @@ -1883,7 +1883,7 @@ end pgroup.test_object_partial_result = function(g) -- bad fields format - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -1898,7 +1898,7 @@ pgroup.test_object_partial_result = function(g) t.assert_str_contains(errs[1].err, 'Space format doesn\'t contain field named "invalid"') -- replace_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'developers', { {id = 1, name = 'Fedor', login = 'FDost'}, @@ -1921,7 +1921,7 @@ end pgroup.test_opts_not_damaged = function(g) -- replace_many local batch_replace_opts = {timeout = 1, fields = {'name', 'login'}} - local new_batch_replace_opts, err = g.cluster.main_server:eval([[ + local new_batch_replace_opts, err = g.router:eval([[ local crud = require('crud') local batch_replace_opts = ... @@ -1938,7 +1938,7 @@ pgroup.test_opts_not_damaged = function(g) -- replace_object_many local batch_replace_opts = {timeout = 1, fields = {'name', 'login'}} - local new_batch_replace_opts, err = g.cluster.main_server:eval([[ + local new_batch_replace_opts, err = g.router:eval([[ local crud = require('crud') local batch_replace_opts = ... @@ -1956,7 +1956,7 @@ end pgroup.test_noreturn_opt = function(g) -- replace_many with noreturn, all tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -1970,7 +1970,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- replace_many with noreturn, some tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'customers', { {1, box.NULL, 'Fedor', 59}, @@ -1985,7 +1985,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- replace_many with noreturn, all tuples are not correct - local result, errs = g.cluster.main_server.net_box:call('crud.replace_many', { + local result, errs = g.router:call('crud.replace_many', { 'customers', { {box.NULL, box.NULL, 'Fedor', 59}, @@ -2000,7 +2000,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- replace_object_many with noreturn, all tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'customers', { {id = 1, name = 'Fedor', age = 100}, @@ -2014,7 +2014,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- replace_object_many with noreturn, some tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'customers', { {id = 1, name = 'Fedor', age = 100}, @@ -2029,7 +2029,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- replace_object_many with noreturn, all tuples are not correct - local result, errs = g.cluster.main_server.net_box:call('crud.replace_object_many', { + local result, errs = g.router:call('crud.replace_object_many', { 'customers', { {id = box.NULL, name = 'Fedor', age = 100}, @@ -2045,7 +2045,7 @@ pgroup.test_noreturn_opt = function(g) end pgroup.test_zero_tuples = function(g) - local result, errs = g.cluster.main_server.net_box:call( + local result, errs = g.router:call( 'crud.replace_many', {'customers', {}}) t.assert_not_equals(errs, nil) @@ -2055,7 +2055,7 @@ pgroup.test_zero_tuples = function(g) end pgroup.test_zero_objects = function(g) - local result, errs = g.cluster.main_server.net_box:call( + local result, errs = g.router:call( 'crud.replace_object_many', {'customers', {}}) t.assert_not_equals(errs, nil) diff --git a/test/integration/schema_test.lua b/test/integration/schema_test.lua index 71882dcf..b7fa9dd8 100644 --- a/test/integration/schema_test.lua +++ b/test/integration/schema_test.lua @@ -12,8 +12,6 @@ local pgroup = t.group('schema', helpers.backend_matrix({ pgroup.before_all(function(g) helpers.start_default_cluster(g, 'srv_schema') - - g.router = helpers.get_router(g.cluster, g.params.backend) end) pgroup.after_all(function(g) diff --git a/test/integration/select_readview_test.lua b/test/integration/select_readview_test.lua index 78f33169..973248d2 100644 --- a/test/integration/select_readview_test.lua +++ b/test/integration/select_readview_test.lua @@ -17,7 +17,6 @@ local function init_cluster(g) g.space_format = g.cluster:server('s1-master').net_box.space.customers:format() - g.router = helpers.get_router(g.cluster, g.params.backend) g.router.net_box:eval([[ require('crud').cfg{ stats = true } ]]) @@ -62,7 +61,7 @@ local function set_master(cluster, uuid, master_uuid) end pgroup.test_non_existent_space = function(g) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -80,7 +79,7 @@ pgroup.test_non_existent_space = function(g) end pgroup.test_select_no_index = function(g) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -101,7 +100,7 @@ pgroup.test_invalid_value_type = function(g) {'=', 'id', 'not_number'} } - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -138,7 +137,7 @@ pgroup.test_gc_on_storage = function(g) }) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -154,7 +153,7 @@ pgroup.test_gc_on_storage = function(g) collectgarbage("collect")]]) end) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo') local result, err = foo:select('customers', nil, {fullscan = true}) @@ -173,7 +172,7 @@ pgroup.test_gc_on_storage = function(g) end pgroup.test_gc_rv_not_referenced_on_router = function(g) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -212,7 +211,7 @@ pgroup.test_gc_rv_referenced_on_router = function(g) }, }) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -224,7 +223,7 @@ pgroup.test_gc_rv_referenced_on_router = function(g) ]]) fiber.sleep(1) t.assert_equals(err, nil) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo') local result, err = foo:select('customers', nil, {fullscan = true}) @@ -243,7 +242,7 @@ pgroup.test_gc_rv_referenced_on_router = function(g) end pgroup.test_close = function(g) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -279,7 +278,7 @@ pgroup.test_select_all = function(g) }, }) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -320,7 +319,7 @@ pgroup.test_select_with_same_name = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -367,7 +366,7 @@ pgroup.test_select_without_name = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local boo, err = crud.readview({name = nil}) if err ~= nil then @@ -408,7 +407,7 @@ pgroup.test_select_with_insert = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local boo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -435,7 +434,7 @@ pgroup.test_select_with_insert = function(g) }, }) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local boo = rawget(_G, 'boo') @@ -473,7 +472,7 @@ pgroup.test_select_with_delete = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local boo, err = crud.readview({}) if err ~= nil then @@ -493,10 +492,10 @@ pgroup.test_select_with_delete = function(g) {4, 1161, "William", "White", 81, "Chicago"}, }) - local _, err = g.cluster.main_server.net_box:call('crud.delete', {'customers', 3}) + local _, err = g.router:call('crud.delete', {'customers', 3}) t.assert_equals(err, nil) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local boo = rawget(_G, 'boo') @@ -547,7 +546,7 @@ pgroup.test_select_all_with_batch_size = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- batch size 1 - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) if err ~= nil then @@ -564,7 +563,7 @@ pgroup.test_select_all_with_batch_size = function(g) t.assert_equals(objects, customers) -- batch size 3 - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local bar, err = crud.readview({name = 'bar'}) if err ~= nil then @@ -616,7 +615,7 @@ pgroup.test_eq_condition_with_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -638,7 +637,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -659,7 +658,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 5 with negative first local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -681,7 +680,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 8 local after = crud_utils.flatten(customers[8], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -702,7 +701,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 8 with negative first local after = crud_utils.flatten(customers[8], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -723,7 +722,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -744,7 +743,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 2 with negative first local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -788,7 +787,7 @@ pgroup.test_lt_condition_with_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -809,7 +808,7 @@ pgroup.test_lt_condition_with_index = function(g) -- after obj 1 local after = crud_utils.flatten(customers[1], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -858,7 +857,7 @@ pgroup.test_multiple_conditions = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -879,7 +878,7 @@ pgroup.test_multiple_conditions = function(g) -- after obj 5 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -923,7 +922,7 @@ pgroup.test_composite_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -944,7 +943,7 @@ pgroup.test_composite_index = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -968,7 +967,7 @@ pgroup.test_composite_index = function(g) {'==', 'full_name', "Elizabeth"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -989,7 +988,7 @@ pgroup.test_composite_index = function(g) -- first 1 - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1008,7 +1007,7 @@ pgroup.test_composite_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {2})) -- in full_name order -- first 1 with full specified key - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1041,7 +1040,7 @@ pgroup.test_composite_primary_index = function(g) local conditions = {{'=', 'id', {5, 'Ukrainian', 55}}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1058,7 +1057,7 @@ pgroup.test_composite_primary_index = function(g) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1075,7 +1074,7 @@ pgroup.test_composite_primary_index = function(g) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1092,7 +1091,7 @@ pgroup.test_composite_primary_index = function(g) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after = ... @@ -1143,7 +1142,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- LE local conditions = {{'<=', 'age', 35}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1164,7 +1163,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- LT local conditions = {{'<', 'age', 35}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1185,7 +1184,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- GE local conditions = {{'>=', 'age', 35}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1206,7 +1205,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- GT local conditions = {{'>', 'age', 35}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1243,7 +1242,7 @@ pgroup.test_select_by_full_sharding_key = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) local conditions = {{'==', 'id', 3}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1290,7 +1289,7 @@ pgroup.test_select_with_collations = function(g) -- full name index - unicode ci collation (case-insensitive) local conditions = {{'==', 'name', "Elizabeth"}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1311,7 +1310,7 @@ pgroup.test_select_with_collations = function(g) -- city - no collation (case-sensitive) local conditions = {{'==', 'city', "oxford"}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1341,7 +1340,7 @@ pgroup.test_multipart_primary_index = function(g) }) local conditions = {{'=', 'primary', 0}} - local result_0, err = g.cluster.main_server.net_box:eval([[ + local result_0, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1359,7 +1358,7 @@ pgroup.test_multipart_primary_index = function(g) local objects = crud.unflatten_rows(result_0.rows, result_0.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {1, 2, 3})) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after= ... @@ -1378,7 +1377,7 @@ pgroup.test_multipart_primary_index = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {2, 3})) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after= ... @@ -1397,7 +1396,7 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {1, 2})) local new_conditions = {{'=', 'y', 1}, {'=', 'primary', 0}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after= ... @@ -1416,7 +1415,7 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {2})) local conditions = {{'=', 'primary', {0, 2}}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after= ... @@ -1435,7 +1434,7 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {3})) local conditions_ge = {{'>=', 'primary', 0}} - local result_ge_0, err = g.cluster.main_server.net_box:eval([[ + local result_ge_0, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1453,7 +1452,7 @@ pgroup.test_multipart_primary_index = function(g) local objects = crud.unflatten_rows(result_ge_0.rows, result_ge_0.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {1, 2, 3, 4, 5})) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after= ... @@ -1471,7 +1470,7 @@ pgroup.test_multipart_primary_index = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {2, 3, 4, 5})) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, after= ... @@ -1508,7 +1507,7 @@ pgroup.test_select_partial_result_bad_input = function(g) }) local conditions = {{'>=', 'age', 33}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions= ... @@ -1558,7 +1557,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields= ... @@ -1583,7 +1582,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields, after= ... @@ -1613,7 +1612,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields= ... @@ -1638,7 +1637,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields, after= ... @@ -1671,7 +1670,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", age = 33}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields= ... @@ -1696,7 +1695,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", age = 33}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields, after= ... @@ -1727,7 +1726,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields= ... @@ -1752,7 +1751,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions, fields, after= ... @@ -1775,7 +1774,7 @@ end pgroup.test_select_force_map_call = function(g) local key = 1 - local first_bucket_id = g.cluster.main_server.net_box:eval([[ + local first_bucket_id = g.router:eval([[ local vshard = require('vshard') local key = ... @@ -1798,7 +1797,7 @@ pgroup.test_select_force_map_call = function(g) table.sort(customers, function(obj1, obj2) return obj1.bucket_id < obj2.bucket_id end) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -1814,7 +1813,7 @@ pgroup.test_select_force_map_call = function(g) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -1853,7 +1852,7 @@ pgroup.test_jsonpath = function(g) age = 17, additional = { a = 55 }, }, }) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -1874,7 +1873,7 @@ pgroup.test_jsonpath = function(g) {id = 4, name = "Pavel", last_name = "White"}, } t.assert_equals(objects, expected_objects) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -1931,7 +1930,7 @@ pgroup.test_jsonpath_index_field = function(g) }) -- PK jsonpath index - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -1960,7 +1959,7 @@ pgroup.test_jsonpath_index_field = function(g) t.assert_equals(objects, expected_objects) -- Secondary jsonpath index (partial) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -1990,7 +1989,7 @@ pgroup.test_jsonpath_index_field = function(g) t.assert_equals(objects, expected_objects) -- Secondary jsonpath index (full) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -2074,7 +2073,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) -- Pagination (primary index) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -2092,7 +2091,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {1, 2})) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo') @@ -2108,7 +2107,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {3, 4})) -- Reverse pagination (primary index) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo') @@ -2124,7 +2123,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {1, 2})) -- Pagination (secondary index - 1 field) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo') @@ -2159,7 +2158,7 @@ pgroup.test_select_timeout = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -2210,7 +2209,7 @@ pgroup.test_select_no_map_reduce = function(g) local map_reduces_before = helpers.get_map_reduces_stat(router, 'customers') -- Case: no conditions, just bucket id. - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -2233,7 +2232,7 @@ pgroup.test_select_no_map_reduce = function(g) -- Case: EQ on secondary index, which is not in the sharding -- index (primary index in the case). - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -2256,7 +2255,7 @@ pgroup.test_select_no_map_reduce = function(g) end pgroup.test_select_yield_every_0 = function(g) - local resp, err = g.cluster.main_server.net_box:eval([[ + local resp, err = g.router:eval([[ local crud = require('crud') local foo, err = crud.readview({name = 'foo'}) @@ -2289,7 +2288,7 @@ pgroup.test_stop_select = function(g) }, }) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo = crud.readview({name = 'foo'}) rawset(_G, 'foo', foo) @@ -2298,7 +2297,7 @@ pgroup.test_stop_select = function(g) t.assert_equals(err, nil) g.cluster:server('s2-master'):stop() - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo', foo) local result, err = foo:select('customers', nil, {fullscan = true}) @@ -2322,7 +2321,7 @@ pgroup.test_stop_select = function(g) end, {g.cfg, bootstrap_key}) end - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local foo = rawget(_G, 'foo', foo) foo:close() @@ -2360,7 +2359,7 @@ pgroup.test_select_switch_master = function(g) }, }) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local temp, err = crud.readview({name = 'temp'}) if err ~= nil then @@ -2374,7 +2373,7 @@ pgroup.test_select_switch_master = function(g) local replicasets = helpers.get_test_cartridge_replicasets() set_master(g.cluster, replicasets[2].uuid, replicasets[2]:server('s1-master').instance_uuid) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local temp = rawget(_G, 'temp') local result, err = temp:select('customers', nil, {fullscan = true}) @@ -2413,7 +2412,7 @@ pgroup.test_select_switch_master_first = function(g) }, }) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local temp, err = crud.readview({name = 'temp'}) if err ~= nil then @@ -2430,7 +2429,7 @@ pgroup.test_select_switch_master_first = function(g) local replicasets = helpers.get_test_cartridge_replicasets() set_master(g.cluster, replicasets[3].uuid, replicasets[3]:server('s1-master').instance_uuid) - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local temp = rawget(_G, 'temp') local result, err = temp:select('customers', nil, {fullscan = true}) @@ -2467,7 +2466,7 @@ pgroup.test_select_closed_readview = function(g) }, }) - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local crud = require('crud') local temp, err = crud.readview({name = 'temp'}) if err ~= nil then diff --git a/test/integration/select_test.lua b/test/integration/select_test.lua index 01cca1b8..9a5b5da6 100644 --- a/test/integration/select_test.lua +++ b/test/integration/select_test.lua @@ -15,7 +15,6 @@ pgroup.before_all(function(g) g.space_format = g.cluster:server('s1-master').net_box.space.customers:format() - g.router = helpers.get_router(g.cluster, g.params.backend) g.router.net_box:eval([[ require('crud').cfg{ stats = true } ]]) @@ -37,7 +36,7 @@ end) pgroup.test_non_existent_space = function(g) -- insert - local obj, err = g.cluster.main_server.net_box:call('crud.select', { + local obj, err = g.router:call('crud.select', { 'non_existent_space', nil, {fullscan = true, mode = 'write'}, @@ -48,7 +47,7 @@ pgroup.test_non_existent_space = function(g) end pgroup.test_select_no_index = function(g) - local obj, err = g.cluster.main_server.net_box:call('crud.select', { + local obj, err = g.router:call('crud.select', { 'no_index_space', nil, {fullscan = true, mode = 'write'}, @@ -63,7 +62,7 @@ pgroup.test_not_valid_value_type = function(g) {'=', 'id', 'not_number'} } - local obj, err = g.cluster.main_server.net_box:eval([[ + local obj, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -194,7 +193,7 @@ pgroup.test_select_all = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {fullscan = true, mode = 'write'}, }) @@ -215,7 +214,7 @@ pgroup.test_select_all = function(g) }) -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {fullscan = true, mode = 'write'}, }) @@ -225,7 +224,7 @@ pgroup.test_select_all = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {after = after, fullscan = true, mode = 'write'}, }) @@ -235,7 +234,7 @@ pgroup.test_select_all = function(g) -- after obj 4 (last) local after = crud_utils.flatten(customers[4], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {after = after, fullscan = true, mode = 'write'}, }) @@ -265,7 +264,7 @@ pgroup.test_select_all_with_first = function(g) -- first 2 local first = 2 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {first = first, mode = 'write'}, }) @@ -275,7 +274,7 @@ pgroup.test_select_all_with_first = function(g) -- first 0 local first = 0 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {first = first, mode = 'write'}, }) @@ -319,7 +318,7 @@ pgroup.test_negative_first = function(g) -- first -4 after 6 local first = -4 local after = crud_utils.flatten(customers[6], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {first = first, after = after, mode = 'write'}, }) @@ -334,7 +333,7 @@ pgroup.test_negative_first = function(g) } local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -349,7 +348,7 @@ pgroup.test_negative_first = function(g) } local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -364,7 +363,7 @@ pgroup.test_negative_first = function(g) } local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -379,7 +378,7 @@ pgroup.test_negative_first = function(g) } local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -426,7 +425,7 @@ pgroup.test_positive_first = function(g) } local first = 10 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -441,7 +440,7 @@ pgroup.test_positive_first = function(g) } local first = 10 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -456,7 +455,7 @@ pgroup.test_positive_first = function(g) } local first = 10 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -471,7 +470,7 @@ pgroup.test_positive_first = function(g) } local first = 10 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, mode = 'write'}, }) @@ -513,7 +512,7 @@ pgroup.test_negative_first_with_batch_size = function(g) -- negative first w/o after local first = -10 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {first = first, mode = 'write'}, }) @@ -525,7 +524,7 @@ pgroup.test_negative_first_with_batch_size = function(g) local first = -3 local after = crud_utils.flatten(customers[5], g.space_format) local batch_size = 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {first = first, after = after, batch_size = batch_size, mode = 'write'}, }) @@ -541,7 +540,7 @@ pgroup.test_negative_first_with_batch_size = function(g) local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) local batch_size = 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, batch_size = batch_size, mode = 'write'}, }) @@ -557,7 +556,7 @@ pgroup.test_negative_first_with_batch_size = function(g) local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) local batch_size = 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, batch_size = batch_size, mode = 'write'}, }) @@ -573,7 +572,7 @@ pgroup.test_negative_first_with_batch_size = function(g) local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) local batch_size = 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, batch_size = batch_size, mode = 'write'}, }) @@ -589,7 +588,7 @@ pgroup.test_negative_first_with_batch_size = function(g) local first = -2 local after = crud_utils.flatten(customers[5], g.space_format) local batch_size = 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = first, after = after, batch_size = batch_size, mode = 'write'}, }) @@ -630,7 +629,7 @@ pgroup.test_select_all_with_batch_size = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) -- batch size 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {batch_size = 1, fullscan = true, mode = 'write'}, }) @@ -639,7 +638,7 @@ pgroup.test_select_all_with_batch_size = function(g) t.assert_equals(objects, customers) -- batch size 3 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {batch_size = 3, fullscan = true, mode = 'write'}, }) @@ -648,7 +647,7 @@ pgroup.test_select_all_with_batch_size = function(g) t.assert_equals(objects, customers) -- batch size 3 and first 6 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {batch_size = 3, first = 6, mode = 'write'}, }) @@ -674,7 +673,7 @@ pgroup.test_select_by_primary_index = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) local conditions = {{'==', 'id_index', 3}} - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') local conditions = ... @@ -724,7 +723,7 @@ pgroup.test_eq_condition_with_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {mode = 'write'}, }) @@ -734,7 +733,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, mode = 'write'}, }) @@ -744,7 +743,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 5 with negative first local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, first = -10, mode = 'write'}, }) @@ -754,7 +753,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 8 local after = crud_utils.flatten(customers[8], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, first = 10, mode = 'write'}, }) @@ -764,7 +763,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 8 with negative first local after = crud_utils.flatten(customers[8], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, first = -10, mode = 'write'}, }) @@ -774,7 +773,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, first = 10, mode = 'write'}, }) @@ -784,7 +783,7 @@ pgroup.test_eq_condition_with_index = function(g) -- after obj 2 with negative first local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, first = -10, mode = 'write'}, }) @@ -817,7 +816,7 @@ pgroup.test_ge_condition_with_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -827,7 +826,7 @@ pgroup.test_ge_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, fullscan = true, mode = 'write'}, }) @@ -860,7 +859,7 @@ pgroup.test_le_condition_with_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -870,7 +869,7 @@ pgroup.test_le_condition_with_index = function(g) -- after obj 3 local after = crud_utils.flatten(customers[3], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, fullscan = true, mode = 'write'}, }) @@ -880,7 +879,7 @@ pgroup.test_le_condition_with_index = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, mode = 'write'}, }) @@ -913,7 +912,7 @@ pgroup.test_lt_condition_with_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -923,7 +922,7 @@ pgroup.test_lt_condition_with_index = function(g) -- after obj 1 local after = crud_utils.flatten(customers[1], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, fullscan = true, mode = 'write'}, }) @@ -961,7 +960,7 @@ pgroup.test_multiple_conditions = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {mode = 'write'}, }) @@ -971,7 +970,7 @@ pgroup.test_multiple_conditions = function(g) -- after obj 5 local after = crud_utils.flatten(customers[5], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, fullscan = true, mode = 'write'}, }) @@ -1004,7 +1003,7 @@ pgroup.test_composite_index = function(g) } -- no after - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) @@ -1014,7 +1013,7 @@ pgroup.test_composite_index = function(g) -- after obj 2 local after = crud_utils.flatten(customers[2], g.space_format) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {after = after, fullscan = true, mode = 'write'}, }) @@ -1027,7 +1026,7 @@ pgroup.test_composite_index = function(g) {'==', 'full_name', "Elizabeth"}, } - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {mode = 'write'}, }) @@ -1036,7 +1035,7 @@ pgroup.test_composite_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {2, 1})) -- in full_name order -- first 1 - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {first = 1, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1044,7 +1043,7 @@ pgroup.test_composite_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {2})) -- in full_name order -- first 1 with full specified key - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', {{'==', 'full_name', {'Elizabeth', 'Johnson'}}}, {first = 1,mode = 'write'}, }) t.assert_equals(err, nil) @@ -1066,25 +1065,25 @@ pgroup.test_composite_primary_index = function(g) local conditions = {{'=', 'id', {5, 'Ukrainian', 55}}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'book_translation', conditions, {mode = 'write'}, }) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'book_translation', conditions, {first = 2, mode = 'write'}, }) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'book_translation', conditions, {first = 1, mode = 'write'}, }) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'book_translation', conditions, {first = 1, after = result.rows[1], mode = 'write'}, }) t.assert_equals(err, nil) @@ -1124,7 +1123,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- LE local conditions = {{'<=', 'age', 35}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {batch_size = 1, fullscan = true, mode = 'write'}, }) @@ -1134,7 +1133,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- LT local conditions = {{'<', 'age', 35}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {batch_size = 1, fullscan = true, mode = 'write'}, }) @@ -1144,7 +1143,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- GE local conditions = {{'>=', 'age', 35}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {batch_size = 1, fullscan = true, mode = 'write'}, }) @@ -1154,7 +1153,7 @@ pgroup.test_select_with_batch_size_1 = function(g) -- GT local conditions = {{'>', 'age', 35}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {batch_size = 1, fullscan = true, mode = 'write'}, }) @@ -1180,7 +1179,7 @@ pgroup.test_select_by_full_sharding_key = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) local conditions = {{'==', 'id', 3}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {mode = 'write'}, }) @@ -1216,7 +1215,7 @@ pgroup.test_select_with_collations = function(g) -- full name index - unicode ci collation (case-insensitive) local conditions = {{'==', 'name', "Elizabeth"}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {mode = 'write'}, }) @@ -1226,7 +1225,7 @@ pgroup.test_select_with_collations = function(g) -- city - no collation (case-sensitive) local conditions = {{'==', 'city', "oxford"}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {mode = 'write'}, }) @@ -1245,21 +1244,21 @@ pgroup.test_multipart_primary_index = function(g) }) local conditions = {{'=', 'primary', 0}} - local result_0, err = g.cluster.main_server.net_box:call('crud.select', { + local result_0, err = g.router:call('crud.select', { 'coord', conditions, {mode = 'write'}, }) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result_0.rows, result_0.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {1, 2, 3})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'coord', conditions, {after = result_0.rows[1], mode = 'write'}, }) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {2, 3})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'coord', conditions, {after = result_0.rows[3], first = -2, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1267,7 +1266,7 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {1, 2})) local new_conditions = {{'=', 'y', 1}, {'=', 'primary', 0}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'coord', new_conditions, {after = result_0.rows[3], first = -2, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1275,7 +1274,7 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {2})) local conditions = {{'=', 'primary', {0, 2}}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'coord', conditions, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -1283,21 +1282,21 @@ pgroup.test_multipart_primary_index = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {3})) local conditions_ge = {{'>=', 'primary', 0}} - local result_ge_0, err = g.cluster.main_server.net_box:call('crud.select', { + local result_ge_0, err = g.router:call('crud.select', { 'coord', conditions_ge, {fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result_ge_0.rows, result_ge_0.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {1, 2, 3, 4, 5})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'coord', conditions_ge, {after = result_ge_0.rows[1], fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(coords, {2, 3, 4, 5})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'coord', conditions_ge, {after = result_ge_0.rows[3], first = -3, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1323,7 +1322,7 @@ pgroup.test_select_partial_result_bad_input = function(g) }) local conditions = {{'>=', 'age', 33}} - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fields = {'id', 'mame'}, fullscan = true, mode = 'write'}, }) @@ -1362,7 +1361,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fields = fields, fullscan = true, mode = 'write'}, }) @@ -1376,7 +1375,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William", city = "Chicago"}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {after = result.rows[1], fields = fields, fullscan = true, mode = 'write'}, }) @@ -1395,7 +1394,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {fields = fields, fullscan = true, mode = 'write'}, }) @@ -1409,7 +1408,7 @@ pgroup.test_select_partial_result = function(g) {id = 4, age = 46, name = "William"}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {after = result.rows[1], fields = fields, fullscan = true, mode = 'write'}, }) @@ -1431,7 +1430,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", age = 33}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {fields = fields, fullscan = true, mode = 'write'}, }) @@ -1445,7 +1444,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", age = 33}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {after = result.rows[1], fields = fields, fullscan = true, mode = 'write'}, }) @@ -1464,7 +1463,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {fields = fields, fullscan = true, mode = 'write'}, }) @@ -1478,7 +1477,7 @@ pgroup.test_select_partial_result = function(g) {id = 3, name = "David", city = "Los Angeles"}, } - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', conditions, {after = result.rows[1], fields = fields, fullscan = true, mode = 'write'}, }) @@ -1517,13 +1516,13 @@ pgroup.test_cut_selected_rows = function(g) } -- with fields option - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fields = fields, fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) - result, err = g.cluster.main_server.net_box:call('crud.cut_rows', {result.rows, result.metadata, fields}) + result, err = g.router:call('crud.cut_rows', {result.rows, result.metadata, fields}) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) @@ -1540,13 +1539,13 @@ pgroup.test_cut_selected_rows = function(g) {bucket_id = 1161, id = 4, name = "William"}, } - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', conditions, {fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) - result, err = g.cluster.main_server.net_box:call('crud.cut_rows', {result.rows, result.metadata, fields}) + result, err = g.router:call('crud.cut_rows', {result.rows, result.metadata, fields}) t.assert_equals(err, nil) local objects = crud.unflatten_rows(result.rows, result.metadata) @@ -1556,7 +1555,7 @@ end pgroup.test_select_force_map_call = function(g) local key = 1 - local first_bucket_id = g.cluster.main_server.net_box:eval([[ + local first_bucket_id = g.router:eval([[ local vshard = require('vshard') local key = ... @@ -1579,14 +1578,14 @@ pgroup.test_select_force_map_call = function(g) table.sort(customers, function(obj1, obj2) return obj1.bucket_id < obj2.bucket_id end) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', {{'==', 'id', key}}, {mode = 'write'}, }) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) - result, err = g.cluster.main_server.net_box:call('crud.select', { + result, err = g.router:call('crud.select', { 'customers', {{'==', 'id', key}}, {force_map_call = true, mode = 'write'}, }) @@ -1617,7 +1616,7 @@ pgroup.test_jsonpath = function(g) }, }) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'developers', {{'>=', '[5]', 40}}, {fields = {'name', 'last_name'}, fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1629,7 +1628,7 @@ pgroup.test_jsonpath = function(g) } t.assert_equals(objects, expected_objects) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'developers', {{'<', '["age"]', 21}}, {fields = {'name', 'last_name'}, fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1641,7 +1640,7 @@ pgroup.test_jsonpath = function(g) } t.assert_equals(objects, expected_objects) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'developers', {{'>=', '[6].a.b', 55}}, {fields = {'name', 'last_name'}, fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1688,7 +1687,7 @@ pgroup.test_jsonpath_index_field = function(g) }) -- PK jsonpath index - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'<=', 'id_ind', 3}, {'<=', 'age', 5}}, {fields = {'id', 'age'}, fullscan = true, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1707,7 +1706,7 @@ pgroup.test_jsonpath_index_field = function(g) t.assert_equals(objects, expected_objects) -- Secondary jsonpath index (partial) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'==', 'data_index', 'Yellow'}}, {fields = {'id', 'age'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1728,7 +1727,7 @@ pgroup.test_jsonpath_index_field = function(g) t.assert_equals(objects, expected_objects) -- Secondary jsonpath index (full) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'==', 'data_index', {'Yellow', 'Mercedes'}}}, {fields = {'id', 'age'}, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1803,7 +1802,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) -- Pagination (primary index) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', nil, {first = 2, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1811,7 +1810,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {1, 2})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', nil, {first = 2, after = result.rows[2], mode = 'write'}, }) t.assert_equals(err, nil) @@ -1820,7 +1819,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {3, 4})) -- Reverse pagination (primary index) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', nil, {first = -2, after = result.rows[1], mode = 'write'}, }) t.assert_equals(err, nil) @@ -1829,7 +1828,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {1, 2})) -- Pagination (secondary index - 1 field) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'==', 'data_index', 'Yellow'}}, {first = 2, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1837,7 +1836,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {1, 2})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'==', 'data_index', 'Yellow'}}, {first = 2, after = result.rows[2], mode = 'write'}, }) t.assert_equals(err, nil) @@ -1846,7 +1845,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {3, 4})) -- Reverse pagination (secondary index - 1 field) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'==', 'data_index', 'Yellow'}}, {first = -2, after = result.rows[1], mode = 'write'}, }) t.assert_equals(err, nil) @@ -1855,7 +1854,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {1, 2})) -- Pagination (secondary index - 2 fields) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'>=', 'data_index', {'Yellow', 'E'}}}, {first = 2, mode = 'write'}, }) t.assert_equals(err, nil) @@ -1863,7 +1862,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {5, 6})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'>=', 'data_index', {'Yellow', 'E'}}}, {first = 2, after = result.rows[2], mode = 'write'}, }) t.assert_equals(err, nil) @@ -1871,7 +1870,7 @@ pgroup.test_jsonpath_index_field_pagination = function(g) local objects = crud.unflatten_rows(result.rows, result.metadata) t.assert_equals(objects, helpers.get_objects_by_idxs(cars, {7, 8})) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'cars', {{'>=', 'data_index', {'Yellow', 'B'}}, {'<=', 'id_ind', 3}}, {first = -3, after = result.rows[1], mode = 'write'}, @@ -1901,7 +1900,7 @@ pgroup.test_select_timeout = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {timeout = 1, fullscan = true, mode = 'write'}, }) @@ -1943,7 +1942,7 @@ pgroup.test_opts_not_damaged = function(g) fields = fields, mode = 'read', prefer_replica = false, balance = false, force_map_call = false, } - local new_select_opts, err = g.cluster.main_server:eval([[ + local new_select_opts, err = g.router:eval([[ local crud = require('crud') local select_opts = ... @@ -1986,7 +1985,7 @@ pgroup.test_select_no_map_reduce = function(g) local map_reduces_before = helpers.get_map_reduces_stat(router, 'customers') -- Case: no conditions, just bucket id. - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', nil, {bucket_id = 2804, timeout = 1, fullscan = true, mode = 'write'}, @@ -2002,7 +2001,7 @@ pgroup.test_select_no_map_reduce = function(g) -- Case: EQ on secondary index, which is not in the sharding -- index (primary index in the case). - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', {{'==', 'age', 81}}, {bucket_id = 1161, timeout = 1, mode = 'write'}, @@ -2045,7 +2044,7 @@ pgroup.after_test('test_storage_nil_err_is_processed', function(g) end) pgroup.test_storage_nil_err_is_processed = function(g) - local obj, err = g.cluster.main_server.net_box:call('crud.select', { + local obj, err = g.router:call('crud.select', { 'customers', {{'==', 'age', 101}} }) t.assert_equals(obj, nil) @@ -2074,7 +2073,7 @@ pgroup.after_test('test_storage_uninit_select_error_text', function(g) end) pgroup.test_storage_uninit_select_error_text = function(g) - local obj, err = g.cluster.main_server.net_box:call('crud.select', { + local obj, err = g.router:call('crud.select', { 'customers', {{'==', 'age', 101}} }) t.assert_equals(obj, nil) @@ -2106,7 +2105,7 @@ pgroup.after_test('test_storage_uninit_get_error_text', function(g) end) pgroup.test_storage_uninit_get_error_text = function(g) - local obj, err = g.cluster.main_server.net_box:call('crud.get', {'customers', 1}) + local obj, err = g.router:call('crud.get', {'customers', 1}) t.assert_equals(obj, nil) t.assert_str_contains(err.str, 'GetError') t.assert_str_contains(err.str, 'NotInitialized') @@ -2234,14 +2233,14 @@ for op, case in pairs(cases) do opts.yield_every = 1 reset_yield_counters_on_storages(g) - local resp, err = g.cluster.main_server.net_box:eval(case.eval, {'customers', conditions, opts}) + local resp, err = g.router:eval(case.eval, {'customers', conditions, opts}) t.assert_equals(err, nil) t.assert_equals(#resp.rows, 1000) local yield_count_on_each = get_yields_count(g) opts.yield_every = customers_count * 2 reset_yield_counters_on_storages(g) - local resp, err = g.cluster.main_server.net_box:eval(case.eval, {'customers', conditions, opts}) + local resp, err = g.router:eval(case.eval, {'customers', conditions, opts}) t.assert_equals(err, nil) t.assert_equals(#resp.rows, 1000) local yield_count_none = get_yields_count(g) @@ -2255,7 +2254,7 @@ for op, case in pairs(cases) do end pgroup.test_select_yield_every_0 = function(g) - local resp, err = g.cluster.main_server.net_box:call('crud.select', { + local resp, err = g.router:call('crud.select', { 'customers', nil, {yield_every = 0, fullscan = true, mode = 'write'}, }) t.assert_equals(resp, nil) @@ -2264,7 +2263,7 @@ end pgroup.test_pairs_yield_every_0 = function(g) t.assert_error_msg_contains("yield_every should be > 0", function() - g.cluster.main_server.net_box:call('crud.pairs', + g.router:call('crud.pairs', {'customers', nil, {yield_every = 0, mode = 'write'}, }) end) diff --git a/test/integration/simple_operations_test.lua b/test/integration/simple_operations_test.lua index 5a419aeb..58f477d0 100644 --- a/test/integration/simple_operations_test.lua +++ b/test/integration/simple_operations_test.lua @@ -24,61 +24,61 @@ pgroup.before_each(function(g) end) pgroup.test_non_existent_space = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert', {'non_existent_space', {0, box.NULL, 'Fedor', 59}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'non_existent_space', {id = 0, name = 'Fedor', age = 59}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', {'non_existent_space', 0}) + local result, err = g.router:call('crud.get', {'non_existent_space', 0}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- update - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.update', {'non_existent_space', 0, {{'+', 'age', 1}}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- delete - local result, err = g.cluster.main_server.net_box:call('crud.delete', {'non_existent_space', 0}) + local result, err = g.router:call('crud.delete', {'non_existent_space', 0}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- replace - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace', {'non_existent_space', {0, box.NULL, 'Fedor', 59}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- replace_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace', {'non_existent_space', {id = 0, name = 'Fedor', age = 59}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- upsert - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert', {'non_existent_space', {0, box.NULL, 'Fedor', 59}, {{'+', 'age', 1}}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, 'Space "non_existent_space" doesn\'t exist') -- upsert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert', {'non_existent_space', {id = 0, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}) t.assert_equals(result, nil) @@ -87,7 +87,7 @@ end pgroup.test_insert_object_get = function(g) -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'customers', {id = 1, name = 'Fedor', age = 59}}) t.assert_equals(err, nil) @@ -101,7 +101,7 @@ pgroup.test_insert_object_get = function(g) t.assert_equals(objects, {{id = 1, name = 'Fedor', age = 59, bucket_id = 477}}) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 1, {mode = 'write'}, }) @@ -111,14 +111,14 @@ pgroup.test_insert_object_get = function(g) t.assert_equals(objects, {{id = 1, name = 'Fedor', age = 59, bucket_id = 477}}) -- insert_object again - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert_object', {'customers', {id = 1, name = 'Alexander', age = 37}}) t.assert_equals(obj, nil) t.assert_str_contains(err.err, "Duplicate key exists") -- bad format - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert_object', {'customers', {id = 2, name = 'Alexander'}}) t.assert_equals(obj, nil) @@ -127,7 +127,7 @@ end pgroup.test_insert_get = function(g) -- insert - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert', {'customers', {2, box.NULL, 'Ivan', 20}}) t.assert_equals(err, nil) @@ -140,7 +140,7 @@ pgroup.test_insert_get = function(g) t.assert_equals(result.rows, {{2, 401, 'Ivan', 20}}) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 2, {mode = 'write'}, }) @@ -149,13 +149,13 @@ pgroup.test_insert_get = function(g) t.assert_equals(result.rows, {{2, 401, 'Ivan', 20}}) -- insert again - local obj, err = g.cluster.main_server.net_box:call('crud.insert', {'customers', {2, box.NULL, 'Ivan', 20}}) + local obj, err = g.router:call('crud.insert', {'customers', {2, box.NULL, 'Ivan', 20}}) t.assert_equals(obj, nil) t.assert_str_contains(err.err, "Duplicate key exists") -- get non-existent - local result, err = g.cluster.main_server.net_box:eval([[ + local result, err = g.router:eval([[ local crud = require('crud') return crud.get('customers', 100, {mode = 'write'}) ]]) @@ -166,7 +166,7 @@ end pgroup.test_update = function(g) -- insert tuple - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'customers', {id = 22, name = 'Leo', age = 72}}) t.assert_equals(err, nil) @@ -180,7 +180,7 @@ pgroup.test_update = function(g) t.assert_equals(objects, {{id = 22, name = 'Leo', age = 72, bucket_id = 655}}) -- update age and name fields - local result, err = g.cluster.main_server.net_box:call('crud.update', {'customers', 22, { + local result, err = g.router:call('crud.update', {'customers', 22, { {'+', 'age', 10}, {'=', 'name', 'Leo Tolstoy'}, }}) @@ -190,7 +190,7 @@ pgroup.test_update = function(g) t.assert_equals(objects, {{id = 22, name = 'Leo Tolstoy', age = 82, bucket_id = 655}}) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 22, {mode = 'write'}, }) @@ -199,14 +199,14 @@ pgroup.test_update = function(g) t.assert_equals(objects, {{id = 22, name = 'Leo Tolstoy', age = 82, bucket_id = 655}}) -- bad key - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.update', {'customers', 'bad-key', {{'+', 'age', 10},}}) t.assert_equals(result, nil) t.assert_str_contains(err.err, "Supplied key type of part 0 does not match index part type:") -- update by field numbers - local result, err = g.cluster.main_server.net_box:call('crud.update', {'customers', 22, { + local result, err = g.router:call('crud.update', {'customers', 22, { {'-', 4, 10}, {'=', 3, 'Leo'} }}) @@ -216,7 +216,7 @@ pgroup.test_update = function(g) t.assert_equals(objects, {{id = 22, name = 'Leo', age = 72, bucket_id = 655}}) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 22, {mode = 'write'}, }) @@ -227,7 +227,7 @@ end pgroup.test_delete = function(g) -- insert tuple - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'customers', {id = 33, name = 'Mayakovsky', age = 36}}) t.assert_equals(err, nil) @@ -241,7 +241,7 @@ pgroup.test_delete = function(g) t.assert_equals(objects, {{id = 33, name = 'Mayakovsky', age = 36, bucket_id = 907}}) -- delete - local result, err = g.cluster.main_server.net_box:call('crud.delete', {'customers', 33}) + local result, err = g.router:call('crud.delete', {'customers', 33}) t.assert_equals(err, nil) if g.params.engine == 'memtx' then @@ -252,7 +252,7 @@ pgroup.test_delete = function(g) end -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 33, {mode = 'write'}, }) @@ -260,7 +260,7 @@ pgroup.test_delete = function(g) t.assert_equals(#result.rows, 0) -- bad key - local result, err = g.cluster.main_server.net_box:call('crud.delete', {'customers', 'bad-key'}) + local result, err = g.router:call('crud.delete', {'customers', 'bad-key'}) t.assert_equals(result, nil) t.assert_str_contains(err.err, "Supplied key type of part 0 does not match index part type:") @@ -268,7 +268,7 @@ end pgroup.test_replace_object = function(g) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 44, {mode = 'write'}, }) @@ -282,7 +282,7 @@ pgroup.test_replace_object = function(g) t.assert_equals(#result.rows, 0) -- replace_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', {'customers', {id = 44, name = 'John Doe', age = 25}}) t.assert_equals(err, nil) @@ -290,7 +290,7 @@ pgroup.test_replace_object = function(g) t.assert_equals(objects, {{id = 44, name = 'John Doe', age = 25, bucket_id = 2805}}) -- replace_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', {'customers', {id = 44, name = 'Jane Doe', age = 18}}) t.assert_equals(err, nil) @@ -299,7 +299,7 @@ pgroup.test_replace_object = function(g) end pgroup.test_replace = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace', {'customers', {45, box.NULL, 'John Fedor', 99}}) t.assert_equals(err, nil) @@ -312,7 +312,7 @@ pgroup.test_replace = function(g) t.assert_equals(result.rows, {{45, 392, 'John Fedor', 99}}) -- replace again - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace', {'customers', {45, box.NULL, 'John Fedor', 100}}) t.assert_equals(err, nil) @@ -321,7 +321,7 @@ end pgroup.test_upsert_object = function(g) -- upsert_object first time - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {'customers', {id = 66, name = 'Jack Sparrow', age = 25}, { {'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'}, @@ -337,7 +337,7 @@ pgroup.test_upsert_object = function(g) t.assert_equals(err, nil) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 66, {mode = 'write'}, }) @@ -346,7 +346,7 @@ pgroup.test_upsert_object = function(g) t.assert_equals(objects, {{id = 66, name = 'Jack Sparrow', age = 25, bucket_id = 486}}) -- upsert_object the same query second time when tuple exists - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert_object', {'customers', {id = 66, name = 'Jack Sparrow', age = 25}, { {'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'}, @@ -356,7 +356,7 @@ pgroup.test_upsert_object = function(g) t.assert_equals(err, nil) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 66, {mode = 'write'}, }) @@ -367,7 +367,7 @@ end pgroup.test_upsert = function(g) -- upsert tuple first time - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert', {'customers', {67, box.NULL, 'Saltykov-Shchedrin', 63}, { {'=', 'name', 'Mikhail Saltykov-Shchedrin'}, }}) @@ -382,7 +382,7 @@ pgroup.test_upsert = function(g) t.assert_equals(err, nil) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 67, {mode = 'write'}, }) @@ -390,7 +390,7 @@ pgroup.test_upsert = function(g) t.assert_equals(result.rows, {{67, 1143, 'Saltykov-Shchedrin', 63}}) -- upsert the same query second time when tuple exists - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.upsert', {'customers', {67, box.NULL, 'Saltykov-Shchedrin', 63}, { {'=', 'name', 'Mikhail Saltykov-Shchedrin'}}}) @@ -398,7 +398,7 @@ pgroup.test_upsert = function(g) t.assert_equals(err, nil) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 67, {mode = 'write'}, }) @@ -407,7 +407,7 @@ pgroup.test_upsert = function(g) end pgroup.test_intermediate_nullable_fields_update = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert', {'developers', {1, box.NULL}}) t.assert_equals(err, nil) @@ -425,7 +425,7 @@ pgroup.test_intermediate_nullable_fields_update = function(g) end end) - local result, err = g.cluster.main_server.net_box:call('crud.update', + local result, err = g.router:call('crud.update', {'developers', 1, {{'=', 'extra_3', { a = { b = {} } } }}, {fetch_latest_metadata = true}}) t.assert_equals(err, nil) objects = crud.unflatten_rows(result.rows, result.metadata) @@ -445,16 +445,16 @@ pgroup.test_intermediate_nullable_fields_update = function(g) -- (https://github.com/tarantool/tarantool/issues/3378). -- So before 2.8 update returns an error but after it update is correct. if helpers.tarantool_version_at_least(2, 8) then - local _, err = g.cluster.main_server.net_box:call('crud.update', + local _, err = g.router:call('crud.update', {'developers', 1, {{'=', '[5].a.b[1]', 3}, {'=', 'extra_5', 'extra_value_5'}}}) t.assert_equals(err, nil) elseif helpers.tarantool_version_at_least(2, 3) then - local _, err = g.cluster.main_server.net_box:call('crud.update', + local _, err = g.router:call('crud.update', {'developers', 1, {{'=', '[5].a.b[1]', 3}, {'=', 'extra_5', 'extra_value_5'}}}) t.assert_equals(err.err, "Failed to update: Field ''extra_5'' was not found in the tuple") end - result, err = g.cluster.main_server.net_box:call('crud.update', + result, err = g.router:call('crud.update', {'developers', 1, {{'=', 5, 'extra_value_3'}, {'=', 7, 'extra_value_5'}}}) t.assert_equals(err, nil) objects = crud.unflatten_rows(result.rows, result.metadata) @@ -470,7 +470,7 @@ pgroup.test_intermediate_nullable_fields_update = function(g) } }) - result, err = g.cluster.main_server.net_box:call('crud.update', + result, err = g.router:call('crud.update', {'developers', 1, { {'=', 14, 'extra_value_12'}, {'=', 'extra_9', 'extra_value_9'}, @@ -681,13 +681,13 @@ for case_name, case in pairs(gh_236_cases) do local result, err -- Perform request to fetch initial space format. - result, err = g.cluster.main_server.net_box:call( + result, err = g.router:call( 'crud.delete', {'countries', 3}) t.assert_not_equals(result, nil) t.assert_equals(err, nil) if case.need_pre_insert_data then - result, err = g.cluster.main_server.net_box:call( + result, err = g.router:call( 'crud.insert', {'countries', {3, box.NULL, 'vatican', 825, 'extra_test_data'}}) t.assert_equals(err, nil) t.assert_not_equals(result, nil) @@ -701,7 +701,7 @@ for case_name, case in pairs(gh_236_cases) do end) if case.operation_name ~= 'crud.pairs' then - result, err = g.cluster.main_server.net_box:call(case.operation_name, case.input) + result, err = g.router:call(case.operation_name, case.input) t.assert_equals(err, nil) local found_extra_field = false for _, v in pairs(result.metadata) do @@ -713,7 +713,7 @@ for case_name, case in pairs(gh_236_cases) do string.format('cannot find the expected metadata for case: %s', case.operation_name)) else - local object = g.cluster.main_server.net_box:eval([[ + local object = g.router:eval([[ local objects = {} for _, object in crud.pairs( 'countries', @@ -740,7 +740,7 @@ end pgroup.test_object_with_nullable_fields = function(g) -- Insert - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'tags', {id = 1, is_green = true}}) t.assert_equals(err, nil) @@ -766,7 +766,7 @@ pgroup.test_object_with_nullable_fields = function(g) -- Update -- {1, 477, NULL, true, NULL, NULL, true, NULL, NULL, NULL, NULL, NULL} -- Shouldn't failed because of https://github.com/tarantool/tarantool/issues/3378 - result, err = g.cluster.main_server.net_box:call( + result, err = g.router:call( 'crud.update', {'tags', 1, {{'=', 'is_sweet', true}}}) t.assert_equals(err, nil) objects = crud.unflatten_rows(result.rows, result.metadata) @@ -789,7 +789,7 @@ pgroup.test_object_with_nullable_fields = function(g) -- Replace -- {2, 401, NULL, true, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL} - result, err = g.cluster.main_server.net_box:call( + result, err = g.router:call( 'crud.replace_object', {'tags', {id = 2, is_green = true}}) t.assert_equals(err, nil) objects = crud.unflatten_rows(result.rows, result.metadata) @@ -812,7 +812,7 @@ pgroup.test_object_with_nullable_fields = function(g) -- Upsert: first is insert then update -- {3, 2804, NULL, NULL, NULL, NULL, NULL, true, NULL, NULL, NULL, NULL} - local _, err = g.cluster.main_server.net_box:call( + local _, err = g.router:call( 'crud.upsert_object', {'tags', {id = 3, is_dirty = true}, { {'=', 'is_dirty', true}, }}) @@ -820,14 +820,14 @@ pgroup.test_object_with_nullable_fields = function(g) -- {3, 2804, NULL, NULL, NULL, NULL, NULL, true, NULL, true, true, NULL} -- Shouldn't failed because of https://github.com/tarantool/tarantool/issues/3378 - _, err = g.cluster.main_server.net_box:call( + _, err = g.router:call( 'crud.upsert_object', {'tags', {id = 3, is_dirty = true}, { {'=', 'is_useful', true}, }}) t.assert_equals(err, nil) -- Get - result, err = g.cluster.main_server.net_box:call('crud.get', { + result, err = g.router:call('crud.get', { 'tags', 3, {mode = 'write'}, }) t.assert_equals(err, nil) @@ -852,7 +852,7 @@ end pgroup.test_get_partial_result = function(g) -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24} @@ -870,7 +870,7 @@ pgroup.test_get_partial_result = function(g) t.assert_equals(objects, {{id = 1, name = 'Elizabeth', age = 24, bucket_id = 477}}) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 1, {fields = {'id', 'name'}, mode = 'write'}, }) @@ -884,7 +884,7 @@ end pgroup.test_insert_tuple_partial_result = function(g) -- insert - local result, err = g.cluster.main_server.net_box:call( 'crud.insert', { + local result, err = g.router:call( 'crud.insert', { 'customers', {1, box.NULL, 'Elizabeth', 24}, {fields = {'id', 'name'}} }) @@ -898,7 +898,7 @@ end pgroup.test_insert_object_partial_result = function(g) -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24}, @@ -916,7 +916,7 @@ end pgroup.test_delete_partial_result = function(g) -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24} @@ -934,7 +934,7 @@ pgroup.test_delete_partial_result = function(g) t.assert_equals(objects, {{id = 1, name = 'Elizabeth', age = 24, bucket_id = 477}}) -- delete - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.delete', { 'customers', 1, {fields = {'id', 'name'}} } @@ -956,7 +956,7 @@ end pgroup.test_update_partial_result = function(g) -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 23} @@ -974,7 +974,7 @@ pgroup.test_update_partial_result = function(g) t.assert_equals(objects, {{id = 1, name = 'Elizabeth', age = 23, bucket_id = 477}}) -- update - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers', 1, {{'+', 'age', 1},}, {fields = {'id', 'age'}} }) @@ -987,7 +987,7 @@ pgroup.test_update_partial_result = function(g) end pgroup.test_replace_tuple_partial_result = function(g) - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace', { 'customers', {1, box.NULL, 'Elizabeth', 23}, @@ -1003,7 +1003,7 @@ pgroup.test_replace_tuple_partial_result = function(g) t.assert_equals(result.rows, {{1, 23}}) -- replace again - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace', { 'customers', {1, box.NULL, 'Elizabeth', 24}, @@ -1021,7 +1021,7 @@ end pgroup.test_replace_object_partial_result = function(g) -- get - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'customers', 1, {mode = 'write'}, }) @@ -1035,7 +1035,7 @@ pgroup.test_replace_object_partial_result = function(g) }) -- replace_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', { 'customers', {id = 1, name = 'Elizabeth', age = 23}, @@ -1052,7 +1052,7 @@ pgroup.test_replace_object_partial_result = function(g) t.assert_equals(objects, {{id = 1, age = 23}}) -- replace_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24}, @@ -1071,7 +1071,7 @@ end pgroup.test_upsert_tuple_partial_result = function(g) -- upsert tuple first time - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', {1, box.NULL, 'Elizabeth', 23}, {{'+', 'age', 1},}, @@ -1086,7 +1086,7 @@ pgroup.test_upsert_tuple_partial_result = function(g) }) -- upsert second time - result, err = g.cluster.main_server.net_box:call('crud.upsert', { + result, err = g.router:call('crud.upsert', { 'customers', {1, box.NULL, 'Elizabeth', 23}, {{'+', 'age', 1},}, @@ -1103,7 +1103,7 @@ end pgroup.test_upsert_object_partial_result = function(g) -- upsert_object first time - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 23}, {{'+', 'age', 1},}, @@ -1118,7 +1118,7 @@ pgroup.test_upsert_object_partial_result = function(g) }) -- upsert_object second time - result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + result, err = g.router:call('crud.upsert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 23}, {{'+', 'age', 1},}, @@ -1135,7 +1135,7 @@ end pgroup.test_partial_result_with_nullable_fields = function(g) -- Insert - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', {'tags', {id = 1, is_green = true}}) t.assert_equals(err, nil) @@ -1158,7 +1158,7 @@ pgroup.test_partial_result_with_nullable_fields = function(g) } }) - local result, err = g.cluster.main_server.net_box:call('crud.get', { + local result, err = g.router:call('crud.get', { 'tags', 1, {fields = {'id', 'is_sweet', 'is_green'}, mode = 'write'}, }) @@ -1174,7 +1174,7 @@ end pgroup.test_partial_result_bad_input = function(g) -- insert_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.insert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24}, @@ -1186,7 +1186,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- get - result, err = g.cluster.main_server.net_box:call('crud.get', { + result, err = g.router:call('crud.get', { 'customers', 1, {fields = {'id', 'lastname', 'name'}, mode = 'write'}, }) @@ -1194,7 +1194,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- update - result, err = g.cluster.main_server.net_box:call('crud.update', { + result, err = g.router:call('crud.update', { 'customers', 1, {{'+', 'age', 1},}, {fields = {'id', 'lastname', 'age'}} }) @@ -1203,7 +1203,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- delete - result, err = g.cluster.main_server.net_box:call( + result, err = g.router:call( 'crud.delete', { 'customers', 1, {fields = {'id', 'lastname', 'name'}} @@ -1214,7 +1214,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- replace - result, err = g.cluster.main_server.net_box:call( + result, err = g.router:call( 'crud.replace', { 'customers', {1, box.NULL, 'Elizabeth', 23}, @@ -1226,7 +1226,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- replace_object - local result, err = g.cluster.main_server.net_box:call( + local result, err = g.router:call( 'crud.replace_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24}, @@ -1238,7 +1238,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- upsert - result, err = g.cluster.main_server.net_box:call('crud.upsert', { + result, err = g.router:call('crud.upsert', { 'customers', {1, box.NULL, 'Elizabeth', 24}, {{'+', 'age', 1},}, @@ -1249,7 +1249,7 @@ pgroup.test_partial_result_bad_input = function(g) t.assert_str_contains(err.err, 'Space format doesn\'t contain field named "lastname"') -- upsert_object - result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + result, err = g.router:call('crud.upsert_object', { 'customers', {id = 1, name = 'Elizabeth', age = 24}, {{'+', 'age', 1},}, @@ -1263,7 +1263,7 @@ end pgroup.test_tuple_not_damaged = function(g) -- insert local insert_tuple = {22, box.NULL, 'Elizabeth', 24} - local new_insert_tuple, err = g.cluster.main_server:eval([[ + local new_insert_tuple, err = g.router:eval([[ local crud = require('crud') local insert_tuple = ... @@ -1278,7 +1278,7 @@ pgroup.test_tuple_not_damaged = function(g) -- upsert local upsert_tuple = {33, box.NULL, 'Peter', 35} - local new_upsert_tuple, err = g.cluster.main_server:eval([[ + local new_upsert_tuple, err = g.router:eval([[ local crud = require('crud') local upsert_tuple = ... @@ -1293,7 +1293,7 @@ pgroup.test_tuple_not_damaged = function(g) -- replace local replace_tuple = {22, box.NULL, 'Elizabeth', 24} - local new_replace_tuple, err = g.cluster.main_server:eval([[ + local new_replace_tuple, err = g.router:eval([[ local crud = require('crud') local replace_tuple = ... @@ -1310,7 +1310,7 @@ end pgroup.test_opts_not_damaged = function(g) -- insert local insert_opts = {timeout = 1, bucket_id = 655, fields = {'name', 'age'}} - local new_insert_opts, err = g.cluster.main_server:eval([[ + local new_insert_opts, err = g.router:eval([[ local crud = require('crud') local insert_opts = ... @@ -1325,7 +1325,7 @@ pgroup.test_opts_not_damaged = function(g) -- insert_object local insert_opts = {timeout = 1, bucket_id = 477, fields = {'name', 'age'}} - local new_insert_opts, err = g.cluster.main_server:eval([[ + local new_insert_opts, err = g.router:eval([[ local crud = require('crud') local insert_opts = ... @@ -1340,7 +1340,7 @@ pgroup.test_opts_not_damaged = function(g) -- upsert local upsert_opts = {timeout = 1, bucket_id = 907, fields = {'name', 'age'}} - local new_upsert_opts, err = g.cluster.main_server:eval([[ + local new_upsert_opts, err = g.router:eval([[ local crud = require('crud') local upsert_opts = ... @@ -1355,7 +1355,7 @@ pgroup.test_opts_not_damaged = function(g) -- upsert_object local upsert_opts = {timeout = 1, bucket_id = 401, fields = {'name', 'age'}} - local new_upsert_opts, err = g.cluster.main_server:eval([[ + local new_upsert_opts, err = g.router:eval([[ local crud = require('crud') local upsert_opts = ... @@ -1372,7 +1372,7 @@ pgroup.test_opts_not_damaged = function(g) -- get local get_opts = {timeout = 1, bucket_id = 401, fields = {'name', 'age'}} - local new_get_opts, err = g.cluster.main_server:eval([[ + local new_get_opts, err = g.router:eval([[ local crud = require('crud') local get_opts = ... @@ -1387,7 +1387,7 @@ pgroup.test_opts_not_damaged = function(g) -- update local update_opts = {timeout = 1, bucket_id = 401, fields = {'name', 'age'}} - local new_update_opts, err = g.cluster.main_server:eval([[ + local new_update_opts, err = g.router:eval([[ local crud = require('crud') local update_opts = ... @@ -1402,7 +1402,7 @@ pgroup.test_opts_not_damaged = function(g) -- replace local replace_opts = {timeout = 1, bucket_id = 655, fields = {'name', 'age'}} - local new_replace_opts, err = g.cluster.main_server:eval([[ + local new_replace_opts, err = g.router:eval([[ local crud = require('crud') local replace_opts = ... @@ -1417,7 +1417,7 @@ pgroup.test_opts_not_damaged = function(g) -- replace_object local replace_opts = {timeout = 1, bucket_id = 477, fields = {'name', 'age'}} - local new_replace_opts, err = g.cluster.main_server:eval([[ + local new_replace_opts, err = g.router:eval([[ local crud = require('crud') local replace_opts = ... @@ -1432,7 +1432,7 @@ pgroup.test_opts_not_damaged = function(g) -- delete local delete_opts = {timeout = 1, bucket_id = 401, fields = {'name', 'age'}} - local new_delete_opts, err = g.cluster.main_server:eval([[ + local new_delete_opts, err = g.router:eval([[ local crud = require('crud') local delete_opts = ... @@ -1521,7 +1521,7 @@ for op, case in pairs(gh_328_success_cases) do local test_name = ('test_gh_328_%s_with_sequence'):format(op) pgroup[test_name] = function(g) - local result, err = g.cluster.main_server.net_box:call('crud.' .. op, case.args) + local result, err = g.router:call('crud.' .. op, case.args) t.assert_equals(err, nil) t.assert_equals(#result.rows, 1) @@ -1568,7 +1568,7 @@ for op, case in pairs(gh_328_error_cases) do local test_name = ('test_gh_328_%s_with_sequence_returns_error_without_option'):format(op) pgroup[test_name] = function(g) - local result, err = g.cluster.main_server.net_box:call('crud.' .. op, case.args) + local result, err = g.router:call('crud.' .. op, case.args) t.assert_equals(result, nil) if case.many then @@ -1590,63 +1590,63 @@ end pgroup.test_noreturn_opt = function(g) -- insert with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', {1, box.NULL, 'Elizabeth', 24}, {noreturn = true} }) t.assert_equals(err, nil) t.assert_equals(result, nil) -- insert with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.insert', { + local result, err = g.router:call('crud.insert', { 'customers', {1, box.NULL, 'Elizabeth', 24}, {noreturn = true} }) t.assert_not_equals(err, nil) t.assert_equals(result, nil) -- insert_object with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', { + local result, err = g.router:call('crud.insert_object', { 'customers', {id = 0, name = 'Fedor', age = 59}, {noreturn = true} }) t.assert_equals(err, nil) t.assert_equals(result, nil) -- insert_object with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.insert_object', { + local result, err = g.router:call('crud.insert_object', { 'customers', {id = 0, name = 'Fedor', age = 59}, {noreturn = true} }) t.assert_not_equals(err, nil) t.assert_equals(result, nil) -- replace with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers', {1, box.NULL, 'Elizabeth', 24}, {noreturn = true} }) t.assert_equals(err, nil) t.assert_equals(result, nil) -- replace with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.replace', { + local result, err = g.router:call('crud.replace', { 'customers', {box.NULL, box.NULL, 'Elizabeth', 24}, {noreturn = true} }) t.assert_not_equals(err, nil) t.assert_equals(result, nil) -- replace_object with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.replace_object', { + local result, err = g.router:call('crud.replace_object', { 'customers', {id = 0, name = 'Fedor', age = 59}, {noreturn = true} }) t.assert_equals(err, nil) t.assert_equals(result, nil) -- replace_object with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.replace_object', { + local result, err = g.router:call('crud.replace_object', { 'customers', {id = box.NULL, name = 'Fedor', age = 59}, {noreturn = true} }) t.assert_not_equals(err, nil) t.assert_equals(result, nil) -- upsert with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', {1, box.NULL, 'Alice', 22}, {{'+', 'age', 1}}, {noreturn = true} }) @@ -1654,7 +1654,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.upsert', { + local result, err = g.router:call('crud.upsert', { 'customers', {1, box.NULL, 'Alice', 22}, {{'+', 'unknown', 1}}, {noreturn = true} }) @@ -1662,7 +1662,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_object with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', {id = 0, name = 'Fedor', age = 59}, {{'+', 'age', 1}}, {noreturn = true} }) @@ -1670,7 +1670,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_object with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.upsert_object', { + local result, err = g.router:call('crud.upsert_object', { 'customers', {id = 0, name = 'Fedor', age = 59}, {{'+', 'unknown', 1}}, {noreturn = true} }) @@ -1678,28 +1678,28 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- update with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers', 1, {{'+', 'age', 1},}, {noreturn = true} }) t.assert_equals(err, nil) t.assert_equals(result, nil) -- update with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.update', { + local result, err = g.router:call('crud.update', { 'customers', {box.NULL, box.NULL, 'Elizabeth', 24}, {noreturn = true} }) t.assert_not_equals(err, nil) t.assert_equals(result, nil) -- delete with noreturn success - local result, err = g.cluster.main_server.net_box:call('crud.delete', { + local result, err = g.router:call('crud.delete', { 'customers', 1, {noreturn = true} }) t.assert_equals(err, nil) t.assert_equals(result, nil) -- delete with noreturn fail - local result, err = g.cluster.main_server.net_box:call('crud.delete', { + local result, err = g.router:call('crud.delete', { 'customers', {box.NULL, box.NULL, 'Elizabeth', 24}, {noreturn = true} }) t.assert_not_equals(err, nil) diff --git a/test/integration/stats_test.lua b/test/integration/stats_test.lua index 222be1fd..bf7576da 100644 --- a/test/integration/stats_test.lua +++ b/test/integration/stats_test.lua @@ -35,7 +35,6 @@ local new_space_name = 'newspace' local function before_all(g) helpers.start_default_cluster(g, 'srv_stats') - g.router = helpers.get_router(g.cluster, g.params.backend).net_box if g.params.args.driver == 'metrics' then local is_metrics_supported = g.router:eval([[ return require('crud.stats.metrics_registry').is_supported() @@ -58,7 +57,7 @@ local call_cfg = function(g, way, cfg) require('crud').cfg(...) ]], { cfg }) elseif way == 'role' then - g.cluster.main_server:upload_config{crud = cfg} + g.router:upload_config{crud = cfg} end end @@ -876,7 +875,7 @@ pgroup.test_role_reload_do_not_reset_observations = function(g) local stats_before = get_stats(g) - helpers.reload_roles(g.cluster:server('router')) + helpers.reload_roles(g.router) local stats_after = get_stats(g) t.assert_equals(stats_after, stats_before) @@ -892,7 +891,7 @@ pgroup.test_module_reload_do_not_reset_observations = function(g) local stats_before = get_stats(g) - helpers.reload_package(g.cluster:server('router')) + helpers.reload_package(g.router) local stats_after = get_stats(g) t.assert_equals(stats_after, stats_before) @@ -1192,7 +1191,7 @@ group_metrics.test_role_reload_do_not_reset_metrics_observations = function(g) "See https://github.com/tarantool/metrics/issues/334") helpers.skip_old_tarantool_cartridge_hotreload() - helpers.reload_roles(g.cluster:server('router')) + helpers.reload_roles(g.router) g.router:eval("crud = require('crud')") local metrics = get_metrics(g) validate_metrics(g, metrics) @@ -1233,7 +1232,7 @@ group_metrics.test_stats_changed_in_metrics_registry_after_role_reload = functio "Cartridge roles reload is not supported") helpers.skip_old_tarantool_cartridge_hotreload() - helpers.reload_roles(g.cluster:server('router')) + helpers.reload_roles(g.router) g.router:eval("crud = require('crud')") check_updated_per_call(g) end diff --git a/test/integration/storages_state_test.lua b/test/integration/storages_state_test.lua index 9b7f348a..fc9baf58 100644 --- a/test/integration/storages_state_test.lua +++ b/test/integration/storages_state_test.lua @@ -16,7 +16,7 @@ local function wait_storages_init(g) local attempts_left = 5 local wait_for_init_timeout = 1 while (attempts_left > 0 and not storages_initialized) do - local results, err = g.cluster.main_server.net_box:call("crud.storage_info", {}) + local results, err = g.router:call("crud.storage_info", {}) t.assert_equals(err, nil, "Error getting storage status") storages_initialized = true local count = 0 @@ -84,7 +84,7 @@ end pgroup.test_crud_storage_status_of_stopped_servers = function(g) g.cluster:server("s2-replica"):stop() - local results, err = g.cluster.main_server.net_box:call("crud.storage_info", {}) + local results, err = g.router:call("crud.storage_info", {}) t.assert_equals(err, nil, "Error getting storages info") t.assert_equals(results, build_storage_info(g, { @@ -127,7 +127,7 @@ pgroup.test_disabled_storage_role = function(g) t.assert_not_equals(results, nil, "Failed to disable storage role") - local results, err = g.cluster.main_server.net_box:call("crud.storage_info", {}) + local results, err = g.router:call("crud.storage_info", {}) t.assert_equals(err, nil, "Error getting storages info") t.assert_equals(results, build_storage_info(g, { @@ -169,7 +169,7 @@ pgroup.test_storage_call_failure = function(g) t.assert_not_equals(results, nil, "Eval failed") - local results, err = g.cluster.main_server.net_box:call("crud.storage_info", {}) + local results, err = g.router:call("crud.storage_info", {}) t.assert_equals(err, nil, "Error getting storages info") t.assert_equals(results, build_storage_info(g, { { diff --git a/test/integration/truncate_test.lua b/test/integration/truncate_test.lua index ec663dde..de41a819 100644 --- a/test/integration/truncate_test.lua +++ b/test/integration/truncate_test.lua @@ -24,7 +24,7 @@ end) pgroup.test_non_existent_space = function(g) -- insert - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.truncate', {'non_existent_space'} ) @@ -51,22 +51,22 @@ pgroup.test_truncate = function(g) table.sort(customers, function(obj1, obj2) return obj1.id < obj2.id end) - local result, err = g.cluster.main_server.net_box:call('crud.select', {'customers', nil, {fullscan = true}}) + local result, err = g.router:call('crud.select', {'customers', nil, {fullscan = true}}) t.assert_equals(err, nil) t.assert_gt(#result.rows, 0) - local result, err = g.cluster.main_server.net_box:call('crud.truncate', {'customers'}) + local result, err = g.router:call('crud.truncate', {'customers'}) t.assert_equals(err, nil) t.assert_equals(result, true) - local result, err = g.cluster.main_server.net_box:call('crud.select', {'customers', nil, {fullscan = true}}) + local result, err = g.router:call('crud.select', {'customers', nil, {fullscan = true}}) t.assert_equals(err, nil) t.assert_equals(#result.rows, 0) end pgroup.test_opts_not_damaged = function(g) local truncate_opts = {timeout = 1} - local new_truncate_opts, err = g.cluster.main_server:eval([[ + local new_truncate_opts, err = g.router:eval([[ local crud = require('crud') local truncate_opts = ... diff --git a/test/integration/updated_schema_test.lua b/test/integration/updated_schema_test.lua index 775a1dca..0b463e5f 100644 --- a/test/integration/updated_schema_test.lua +++ b/test/integration/updated_schema_test.lua @@ -22,7 +22,7 @@ end) pgroup.before_each(function(g) helpers.drop_space_on_cluster(g.cluster, 'customers') -- force schema update on router - g.cluster.main_server.net_box:eval([[ + g.router:eval([[ local vshard = require('vshard') for _, replicaset in pairs(vshard.router.routeall()) do if replicaset.locate_master ~= nil then @@ -44,7 +44,7 @@ end) pgroup.test_insert_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 'XXX'}} ) @@ -59,7 +59,7 @@ pgroup.test_insert_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 'XXX'}} ) @@ -69,7 +69,7 @@ end pgroup.test_insert_object_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert_object', {'customers', {id = 11, value = 'XXX'}} ) @@ -84,7 +84,7 @@ pgroup.test_insert_object_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert_object', {'customers', {id = 11, value = 'XXX'}} ) @@ -94,7 +94,7 @@ end pgroup.test_get_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.get', {'customers', 1} ) @@ -109,7 +109,7 @@ pgroup.test_get_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.get', {'customers', 1} ) @@ -119,7 +119,7 @@ end pgroup.test_delete_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.delete', {'customers', 11} ) @@ -134,7 +134,7 @@ pgroup.test_delete_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.delete', {'customers', 11} ) @@ -144,7 +144,7 @@ end pgroup.test_update_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.update', {'customers', 11, {{'=', 'value', 'YYY'}}} ) @@ -159,14 +159,14 @@ pgroup.test_update_non_existent_space = function(g) end) -- insert tuple - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 'XXX'}} ) t.assert_is_not(obj, nil) t.assert_equals(err, nil) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.update', {'customers', 11, {{'=', 'value', 'YYY'}}} ) @@ -176,7 +176,7 @@ end pgroup.test_replace_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace', {'customers', {11, nil, 'XXX'}} ) @@ -191,7 +191,7 @@ pgroup.test_replace_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace', {'customers', {11, nil, 'XXX'}} ) @@ -201,7 +201,7 @@ end pgroup.test_replace_object_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace_object', {'customers', {id = 11, value = 'XXX'}} ) @@ -216,7 +216,7 @@ pgroup.test_replace_object_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace_object', {'customers', {id = 11, value = 'XXX'}} ) @@ -226,7 +226,7 @@ end pgroup.test_upsert_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 'XXX'}, {{'=', 'value', 'YYY'}}} ) @@ -241,7 +241,7 @@ pgroup.test_upsert_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 'XXX'}, {{'=', 'value', 'YYY'}}} ) @@ -251,7 +251,7 @@ end pgroup.test_upsert_object_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert_object', {'customers', {id = 11, value = 'XXX'}, {{'=', 'value', 'YYY'}}} ) @@ -266,7 +266,7 @@ pgroup.test_upsert_object_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert_object', {'customers', {id = 11, value = 'XXX'}, {{'=', 'value', 'YYY'}}} ) @@ -276,7 +276,7 @@ end pgroup.test_select_non_existent_space = function(g) -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.select', {'customers', nil, {fullscan = true}} ) @@ -291,7 +291,7 @@ pgroup.test_select_non_existent_space = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.select', {'customers', nil, {fullscan = true}} ) @@ -302,7 +302,7 @@ end pgroup.test_borders_non_existent_space = function(g) for _, border_func_name in ipairs({'crud.max', 'crud.min'}) do -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( border_func_name, {'customers'} ) @@ -319,7 +319,7 @@ pgroup.test_borders_non_existent_space = function(g) for _, border_func_name in ipairs({'crud.max', 'crud.min'}) do -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( border_func_name, {'customers'} ) @@ -335,7 +335,7 @@ pgroup.test_insert_no_bucket_id_index = function(g) end) -- no bucket ID index error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 'XXX'}} ) @@ -349,7 +349,7 @@ pgroup.test_insert_no_bucket_id_index = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 'XXX'}} ) @@ -364,7 +364,7 @@ pgroup.test_replace_no_bucket_id_index = function(g) end) -- no bucket ID index error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace', {'customers', {11, nil, 'XXX'}} ) @@ -378,7 +378,7 @@ pgroup.test_replace_no_bucket_id_index = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace', {'customers', {11, nil, 'XXX'}} ) @@ -393,7 +393,7 @@ pgroup.test_upsert_no_bucket_id_index = function(g) end) -- no bucket ID index error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 'XXX'}, {{'=', 'value', 'YYY'}}} ) @@ -407,7 +407,7 @@ pgroup.test_upsert_no_bucket_id_index = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 'XXX'}, {{'=', 'value', 'YYY'}}} ) @@ -423,7 +423,7 @@ pgroup.test_insert_field_type_changed = function(g) end) -- value should be string error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 123}} ) @@ -438,7 +438,7 @@ pgroup.test_insert_field_type_changed = function(g) -- check that schema changes were applied -- insert value unsigned - OK - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 123}} ) @@ -454,7 +454,7 @@ pgroup.test_replace_field_type_changed = function(g) end) -- value should be string error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace', {'customers', {11, nil, 123}} ) @@ -469,7 +469,7 @@ pgroup.test_replace_field_type_changed = function(g) -- check that schema changes were applied -- insert value unsigned - OK - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace', {'customers', {11, nil, 123}} ) @@ -485,7 +485,7 @@ pgroup.test_upsert_field_type_changed = function(g) end) -- value should be string error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 123}, {{'=', 'value', 456}}} ) @@ -500,7 +500,7 @@ pgroup.test_upsert_field_type_changed = function(g) -- check that schema changes were applied -- insert value unsigned - OK - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 123}, {{'=', 'value', 456}}} ) @@ -515,14 +515,14 @@ pgroup.test_update_field_added = function(g) server.net_box:call('create_bucket_id_index') end) - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert', {'customers', {11, nil, 'XXX'}} ) t.assert_is_not(obj, nil) t.assert_equals(err, nil) -- unknown field error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.update', {'customers', 11, {{'=', 'extra', 'EXTRRRRA'}}} ) @@ -541,7 +541,7 @@ pgroup.test_update_field_added = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.update', {'customers', 11, {{'=', 'extra', 'EXTRRRRA'}}} ) @@ -557,7 +557,7 @@ pgroup.test_upsert_field_added = function(g) end) -- unknown field error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 'XXX'}, {{'=', 'extra', 'EXTRRRRA'}}} ) @@ -576,7 +576,7 @@ pgroup.test_upsert_field_added = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert', {'customers', {11, nil, 'XXX'}, {{'=', 'extra', 'EXTRRRRA'}}} ) @@ -592,7 +592,7 @@ pgroup.test_select_field_added = function(g) end) -- unknown field (no results) - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.select', {'customers', {{'==', 'extra', 'EXTRRRRA'}}, {fullscan = true}} ) @@ -605,7 +605,7 @@ pgroup.test_select_field_added = function(g) end) -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.select', {'customers', {{'==', 'extra', 'EXTRRRRA'}}, {fullscan = true}} ) @@ -621,7 +621,7 @@ pgroup.test_insert_object_field_type_changed = function(g) end) -- value should be string error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert_object', {'customers', {id = 11, value = 123}} ) @@ -636,7 +636,7 @@ pgroup.test_insert_object_field_type_changed = function(g) -- check that schema changes were applied -- insert value unsigned - OK - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.insert_object', {'customers', {id = 11, value = 123}} ) @@ -652,7 +652,7 @@ pgroup.test_replace_object_field_type_changed = function(g) end) -- value should be string error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace_object', {'customers', {id = 11, value = 123}} ) @@ -667,7 +667,7 @@ pgroup.test_replace_object_field_type_changed = function(g) -- check that schema changes were applied -- insert value unsigned - OK - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.replace_object', {'customers', {id = 11, value = 123}} ) @@ -683,7 +683,7 @@ pgroup.test_upsert_object_field_type_changed = function(g) end) -- value should be string error - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert_object', {'customers', {id = 11, value = 123}, {}} ) @@ -698,7 +698,7 @@ pgroup.test_upsert_object_field_type_changed = function(g) -- check that schema changes were applied -- insert value unsigned - OK - local obj, err = g.cluster.main_server.net_box:call( + local obj, err = g.router:call( 'crud.upsert_object', {'customers', {id = 11, value = 123}, {}} ) @@ -715,7 +715,7 @@ pgroup.test_borders_value_index_added = function(g) for _, border_func_name in ipairs({'crud.max', 'crud.min'}) do -- non-existent space err - local obj, err = g.cluster.main_server.net_box:call(border_func_name, { + local obj, err = g.router:call(border_func_name, { 'customers', 'value_index', {mode = 'write'}, @@ -733,7 +733,7 @@ pgroup.test_borders_value_index_added = function(g) for _, border_func_name in ipairs({'crud.max', 'crud.min'}) do -- check that schema changes were applied - local obj, err = g.cluster.main_server.net_box:call(border_func_name, { + local obj, err = g.router:call(border_func_name, { 'customers', 'value_index', {mode = 'write'}, @@ -754,13 +754,13 @@ pgroup.test_alter_index_parts = function(g) for i = 0, 9 do -- Insert {0, 9}, {1, 8}, ..., {9, 0} paris in index - local _, err = g.cluster.main_server.net_box:call( + local _, err = g.router:call( 'crud.replace', {'customers', {i, nil, tostring(i), 9 - i}}) t.assert_equals(err, nil) end -- Check sort order before alter - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', {{'>=', 'number_value_index', {0, "0"}}}, {fullscan = true, mode = 'write'}, @@ -783,7 +783,7 @@ pgroup.test_alter_index_parts = function(g) fiber.sleep(1) -- Sort order should be new - local result, err = g.cluster.main_server.net_box:call('crud.select', { + local result, err = g.router:call('crud.select', { 'customers', {{'>=', 'number_value_index', {"0", 0}}}, {fullscan = true, mode = 'write'}, diff --git a/test/integration/upsert_many_test.lua b/test/integration/upsert_many_test.lua index 4e938954..9bf8113f 100644 --- a/test/integration/upsert_many_test.lua +++ b/test/integration/upsert_many_test.lua @@ -23,7 +23,7 @@ end) pgroup.test_non_existent_space = function(g) -- upsert_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'non_existent_space', { {{1, box.NULL, 'Alex', 59}, {{'+', 'age', 1}}}, @@ -38,7 +38,7 @@ pgroup.test_non_existent_space = function(g) t.assert_str_contains(errs[1].err, 'Space "non_existent_space" doesn\'t exist') -- upsert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'non_existent_space', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -57,7 +57,7 @@ pgroup.test_non_existent_space = function(g) t.assert_str_contains(errs[3].err, 'Space "non_existent_space" doesn\'t exist') -- upsert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'non_existent_space', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -79,7 +79,7 @@ end pgroup.test_object_bad_format = function(g) -- bad format - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 12}}}, @@ -107,7 +107,7 @@ pgroup.test_object_bad_format = function(g) t.assert_equals(result, {1, 477, 'Fedor', 59}) -- bad format - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', '1'}}}, @@ -133,7 +133,7 @@ pgroup.test_object_bad_format = function(g) -- bad format -- two errors, default: stop_on_error == false - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 2, name = 'Anna'}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -154,7 +154,7 @@ end pgroup.test_all_success = function(g) -- upsert_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Fedor', 59}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -191,7 +191,7 @@ end pgroup.test_object_all_success = function(g) -- upsert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -239,7 +239,7 @@ pgroup.test_one_error = function(g) -- upsert_many -- failed for s1-master - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{22, box.NULL, 'Alex', 34}, {{'=', 'name', 'Peter'},}}, @@ -294,7 +294,7 @@ pgroup.test_object_one_error = function(g) -- upsert_object_many -- failed for s1-master - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 22, name = 'Alex', age = 34}, {{'=', 'name', 'Peter'},}}, @@ -349,7 +349,7 @@ pgroup.test_many_errors = function(g) -- upsert_many -- failed for both: s1-master s2-master - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{22, box.NULL, 'Alex', 34}, {{'=', 'name', 'Peter'},}}, @@ -417,7 +417,7 @@ pgroup.test_object_many_errors = function(g) -- upsert_object_many -- failed for both: s1-master s2-master - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 22, name = 'Alex', age = 34}, {{'=', 'name', 'Peter'},}}, @@ -490,7 +490,7 @@ pgroup.test_no_success = function(g) -- upsert_many -- failed for both: s1-master s2-master - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{22, box.NULL, 'Alex', 34}, {{'=', 'name', 5},}}, @@ -563,7 +563,7 @@ pgroup.test_object_no_success = function(g) -- upsert_object_many -- failed for both: s1-master s2-master - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 22, name = 'Alex', age = 34}, {{'=', 'name', 5},}}, @@ -621,7 +621,7 @@ end pgroup.test_object_bad_format_stop_on_error = function(g) -- bad format -- two errors, stop_on_error == true - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor'}, {{'+', 'age', 12}}}, @@ -641,7 +641,7 @@ end pgroup.test_all_success_stop_on_error = function(g) -- upsert_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Fedor', 59}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -681,7 +681,7 @@ end pgroup.test_object_all_success_stop_on_error = function(g) -- upsert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -735,7 +735,7 @@ pgroup.test_object_partial_success_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = false -- one error on one storage without rollback, inserts stop by error on this storage -- inserts before error are successful - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 22, name = 'Alex', age = 34}, {{'+', 'age', 1}}}, @@ -816,7 +816,7 @@ pgroup.test_partial_success_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = false -- one error on one storage without rollback, inserts stop by error on this storage -- inserts before error are successful - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{22, box.NULL, 'Alex', 34}, {{'+', 'age', 1}}}, @@ -901,7 +901,7 @@ pgroup.test_no_success_stop_on_error = function(g) -- upsert_many -- fails for both: s1-master s2-master -- one error on each storage, all inserts stop by error - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{2, box.NULL, 'Alex', 34}, {{'+', 'age', '1'}}}, @@ -994,7 +994,7 @@ pgroup.test_object_no_success_stop_on_error = function(g) -- upsert_object_many -- fails for both: s1-master s2-master -- one error on each storage, all inserts stop by error - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 2, name = 'Alex', age = 34}, {{'+', 'age', '1'}}}, @@ -1069,7 +1069,7 @@ end pgroup.test_all_success_rollback_on_error = function(g) -- upsert_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Fedor', 59}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -1109,7 +1109,7 @@ end pgroup.test_object_all_success_rollback_on_error = function(g) -- upsert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 25}, {'=', 'name', 'Leo Tolstoy'},}}, @@ -1167,7 +1167,7 @@ pgroup.test_object_partial_success_rollback_on_error = function(g) -- upsert_object_many -- stop_on_error = false, rollback_on_error = true -- two error on one storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 22, name = 'Alex', age = 34}, {{'+', 'age', 1}}}, @@ -1262,7 +1262,7 @@ pgroup.test_partial_success_rollback_on_error = function(g) -- upsert_many -- stop_on_error = false, rollback_on_error = true -- two error on one storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{22, box.NULL, 'Peter', 24}, {{'+', 'age', 1}}}, @@ -1362,7 +1362,7 @@ pgroup.test_no_success_rollback_on_error = function(g) -- upsert_many -- fails for both: s1-master s2-master -- two errors on each storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Olga', 27}, {{'+', 'age', 1}}}, @@ -1481,7 +1481,7 @@ pgroup.test_object_no_success_rollback_on_error = function(g) -- upsert_object_many -- fails for both: s1-master s2-master -- two errors on each storage with rollback - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Olga', age = 27}, {{'+', 'age', 1}}}, @@ -1578,7 +1578,7 @@ end pgroup.test_all_success_rollback_and_stop_on_error = function(g) -- upsert_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{2, box.NULL, 'Anna', 23}, {{'+', 'age', 1}}}, @@ -1620,7 +1620,7 @@ end pgroup.test_object_all_success_rollback_and_stop_on_error = function(g) -- upsert_object_many -- all success - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 2, name = 'Anna', age = 23}, {{'+', 'age', 1}}}, @@ -1675,7 +1675,7 @@ pgroup.test_partial_success_rollback_and_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = true -- two error on one storage with rollback, inserts stop by error on this storage -- inserts before error are rollbacked - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{22, box.NULL, 'Alex', 34}, {{'+', 'age', 1}}}, @@ -1770,7 +1770,7 @@ pgroup.test_object_partial_success_rollback_and_stop_on_error = function(g) -- stop_on_error = true, rollback_on_error = true -- two error on one storage with rollback, inserts stop by error on this storage -- inserts before error are rollbacked - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 22, name = 'Alex', age = 34}, {{'+', 'age', 1}}}, @@ -1851,7 +1851,7 @@ end pgroup.test_partial_result = function(g) -- bad fields format - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{15, box.NULL, 'Fedor', 59}, {{'+', 'age', 1}}}, @@ -1866,7 +1866,7 @@ pgroup.test_partial_result = function(g) t.assert_str_contains(errs[1].err, 'Space format doesn\'t contain field named "invalid"') -- upsert_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Fedor', 59}, {{'+', 'age', 1}}}, @@ -1886,7 +1886,7 @@ end pgroup.test_object_partial_result = function(g) -- bad fields format - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 15, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -1901,7 +1901,7 @@ pgroup.test_object_partial_result = function(g) t.assert_str_contains(errs[1].err, 'Space format doesn\'t contain field named "invalid"') -- upsert_object_many - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -1922,7 +1922,7 @@ end pgroup.test_opts_not_damaged = function(g) -- upsert_many local batch_upsert_opts = {timeout = 1, fields = {'name', 'age'}} - local new_batch_upsert_opts, err = g.cluster.main_server:eval([[ + local new_batch_upsert_opts, err = g.router:eval([[ local crud = require('crud') local batch_upsert_opts = ... @@ -1939,7 +1939,7 @@ pgroup.test_opts_not_damaged = function(g) -- upsert_object_many local batch_upsert_opts = {timeout = 1, fields = {'name', 'age'}} - local new_batch_upsert_opts, err = g.cluster.main_server:eval([[ + local new_batch_upsert_opts, err = g.router:eval([[ local crud = require('crud') local batch_upsert_opts = ... @@ -1957,7 +1957,7 @@ end pgroup.test_noreturn_opt = function(g) -- upsert_many with noreturn, all tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Alex', 59}, {{'+', 'age', 1}}}, @@ -1971,7 +1971,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_many with noreturn, some tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{1, box.NULL, 'Alex', 59}, {{'+', 'age', 1}}}, @@ -1986,7 +1986,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_many with noreturn, all tuples are not correct - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_many', { + local result, errs = g.router:call('crud.upsert_many', { 'customers', { {{box.NULL, box.NULL, 'Alex', 59}, {{'+', 'age', 1}}}, @@ -2001,7 +2001,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_object_many with noreturn, all tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -2015,7 +2015,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_object_many with noreturn, some tuples are correct - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = 1, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -2030,7 +2030,7 @@ pgroup.test_noreturn_opt = function(g) t.assert_equals(result, nil) -- upsert_object_many with noreturn, all tuples are not correct - local result, errs = g.cluster.main_server.net_box:call('crud.upsert_object_many', { + local result, errs = g.router:call('crud.upsert_object_many', { 'customers', { {{id = box.NULL, name = 'Fedor', age = 59}, {{'+', 'age', 1}}}, @@ -2046,7 +2046,7 @@ pgroup.test_noreturn_opt = function(g) end pgroup.test_zero_tuples = function(g) - local result, errs = g.cluster.main_server.net_box:call( + local result, errs = g.router:call( 'crud.upsert_many', {'customers', {}}) t.assert_not_equals(errs, nil) @@ -2056,7 +2056,7 @@ pgroup.test_zero_tuples = function(g) end pgroup.test_zero_objects = function(g) - local result, errs = g.cluster.main_server.net_box:call( + local result, errs = g.router:call( 'crud.upsert_object_many', {'customers', {}}) t.assert_not_equals(errs, nil) diff --git a/test/integration/vshard_custom_test.lua b/test/integration/vshard_custom_test.lua index 2e164a0c..56dd5fbf 100644 --- a/test/integration/vshard_custom_test.lua +++ b/test/integration/vshard_custom_test.lua @@ -85,7 +85,8 @@ pgroup.before_all(function(g) }) g.cluster:start() - g.router = g.cluster:server('router').net_box + + g.router = g.cluster:server('router') end) pgroup.after_all(function(g) helpers.stop_cartridge_cluster(g.cluster) end) diff --git a/test/performance/perf_test.lua b/test/performance/perf_test.lua index 975cf12f..436a6446 100644 --- a/test/performance/perf_test.lua +++ b/test/performance/perf_test.lua @@ -109,7 +109,7 @@ g.before_all(function(g) helpers.start_cluster(g, cartridge_cfg_template, vshard_cfg_template) - g.router = helpers.get_router(g.cluster, g.params.backend).net_box + g.router = g.cluster:server('router') g.router:eval([[ rawset(_G, 'crud', require('crud')) @@ -1152,7 +1152,7 @@ for name, case in pairs(cases) do local connections = {} - local router = helpers.get_router(g.cluster, g.params.backend) + local router = g.router for _ = 1, params.connection_count do local c = net_box:connect(router.net_box_uri, router.net_box_credentials) if c == nil then diff --git a/test/unit/call_test.lua b/test/unit/call_test.lua index f07cbcd4..3332381f 100644 --- a/test/unit/call_test.lua +++ b/test/unit/call_test.lua @@ -68,16 +68,16 @@ pgroup.before_all(function(g) helpers.start_cluster(g, cartridge_cfg_template, vshard_cfg_template) g.clear_vshard_calls = function() - g.cluster.main_server.net_box:call('clear_vshard_calls') + g.router:call('clear_vshard_calls') end g.get_vshard_calls = function() - return g.cluster.main_server.net_box:eval('return _G.vshard_calls') + return g.router:eval('return _G.vshard_calls') end -- patch vshard.router.call* functions local vshard_call_names = {'callro', 'callbro', 'callre', 'callbre', 'callrw'} - g.cluster.main_server.net_box:call('patch_vshard_calls', {vshard_call_names}) + g.router:call('patch_vshard_calls', {vshard_call_names}) end) pgroup.after_all(function(g) @@ -85,7 +85,7 @@ pgroup.after_all(function(g) end) pgroup.test_map_non_existent_func = function(g) - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -98,7 +98,7 @@ pgroup.test_map_non_existent_func = function(g) end pgroup.test_single_non_existent_func = function(g) - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -111,7 +111,7 @@ pgroup.test_single_non_existent_func = function(g) end pgroup.test_map_invalid_mode = function(g) - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -123,7 +123,7 @@ pgroup.test_map_invalid_mode = function(g) end pgroup.test_single_invalid_mode = function(g) - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -135,7 +135,7 @@ pgroup.test_single_invalid_mode = function(g) end pgroup.test_map_no_args = function(g) - local results_map, err = g.cluster.main_server.net_box:eval([[ + local results_map, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -149,7 +149,7 @@ pgroup.test_map_no_args = function(g) end pgroup.test_args = function(g) - local results_map, err = g.cluster.main_server.net_box:eval([[ + local results_map, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -165,7 +165,7 @@ end pgroup.test_timeout = function(g) local timeout = 0.2 - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -184,7 +184,7 @@ end local function check_single_vshard_call(g, exp_vshard_call, opts) g.clear_vshard_calls() - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -198,7 +198,7 @@ end local function check_map_vshard_call(g, exp_vshard_call, opts) g.clear_vshard_calls() - local _, err = g.cluster.main_server.net_box:eval([[ + local _, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -290,7 +290,7 @@ end pgroup.test_any_vshard_call = function(g) g.clear_vshard_calls() - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') @@ -304,7 +304,7 @@ end pgroup.test_any_vshard_call_timeout = function(g) local timeout = 0.2 - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local vshard = require('vshard') local call = require('crud.common.call') diff --git a/test/unit/not_initialized_test.lua b/test/unit/not_initialized_test.lua index 84e5c782..e204bd25 100644 --- a/test/unit/not_initialized_test.lua +++ b/test/unit/not_initialized_test.lua @@ -47,6 +47,8 @@ local cartridge_cfg_template = { pgroup.before_all(function(g) helpers.start_cluster(g, cartridge_cfg_template, vshard_cfg_template) + + g.router = g.cluster:server('router') end) pgroup.after_all(function(g) @@ -54,7 +56,7 @@ pgroup.after_all(function(g) end) pgroup.test_insert = function(g) - local results, err = g.cluster.main_server.net_box:eval([[ + local results, err = g.router:eval([[ local crud = require('crud') return crud.insert('customers', {id = 1, name = 'Fedor', age = 15}) ]]) diff --git a/test/unit/stats_test.lua b/test/unit/stats_test.lua index 4681ccf3..fdaf8c01 100644 --- a/test/unit/stats_test.lua +++ b/test/unit/stats_test.lua @@ -18,7 +18,6 @@ local space_name = 'customers' local function before_all(g) helpers.start_default_cluster(g, 'srv_stats') - g.router = helpers.get_router(g.cluster, g.params.backend).net_box helpers.prepare_simple_functions(g.router) g.router:eval("stats_module = require('crud.stats')") diff --git a/test/vshard_helpers/vtest.lua b/test/vshard_helpers/vtest.lua index 719fb68e..e69d8579 100644 --- a/test/vshard_helpers/vtest.lua +++ b/test/vshard_helpers/vtest.lua @@ -214,13 +214,13 @@ local function router_new(g, name, cfg) end -- --- Start a main_server router. +-- Start a router. -- -local function start_main_server(g, cfg, opts) +local function start_router(g, cfg, opts) local cfg = table.deepcopy(cfg) cfg.engine = nil - local router = router_new(g, 'main_server', cfg) + local router = router_new(g, 'router', cfg) if opts.router_init ~= nil then router:exec(function(router_init) require(router_init)() @@ -565,7 +565,7 @@ local function cluster_new(g, cfg) end end - start_main_server(g, cfg, { + start_router(g, cfg, { router_init = router_init, all_init = all_init, crud_init = crud_init,