Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
better0fdead committed Sep 20, 2023
1 parent 47e504b commit c274763
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 137 deletions.
78 changes: 39 additions & 39 deletions test/integration/pairs_readview_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pgroup.before_each(function(g)
end)


pgroup.test_pairs_no_conditions_readview = function(g)
pgroup.test_pairs_no_conditions = function(g)
local customers = helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand Down Expand Up @@ -74,7 +74,7 @@ pgroup.test_pairs_no_conditions_readview = function(g)
local crud = require('crud')
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers') do
table.insert(objects, object)
end
Expand All @@ -88,7 +88,7 @@ pgroup.test_pairs_no_conditions_readview = function(g)
local crud = require('crud')
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', nil, {use_tomap = false}) do
table.insert(objects, object)
end
Expand All @@ -103,7 +103,7 @@ pgroup.test_pairs_no_conditions_readview = function(g)
local crud = require('crud')
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', nil, {use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -121,7 +121,7 @@ pgroup.test_pairs_no_conditions_readview = function(g)
local after = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', nil, {after = after, use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -140,7 +140,7 @@ pgroup.test_pairs_no_conditions_readview = function(g)
local after = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', nil, {after = after, use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -152,7 +152,7 @@ pgroup.test_pairs_no_conditions_readview = function(g)
t.assert_equals(#objects, 0)
end

pgroup.test_ge_condition_with_index_readview = function(g)
pgroup.test_ge_condition_with_index = function(g)
local customers = helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand Down Expand Up @@ -182,7 +182,7 @@ pgroup.test_ge_condition_with_index_readview = function(g)
local conditions = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -202,7 +202,7 @@ pgroup.test_ge_condition_with_index_readview = function(g)
local conditions, after = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {after = after, use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -214,7 +214,7 @@ pgroup.test_ge_condition_with_index_readview = function(g)
t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {2, 4})) -- in age order
end

pgroup.test_le_condition_with_index_readview = function(g)
pgroup.test_le_condition_with_index = function(g)
local customers = helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand Down Expand Up @@ -242,7 +242,7 @@ pgroup.test_le_condition_with_index_readview = function(g)
local crud = require('crud')
local conditions = ...
foo = crud.readview('foo')
local foo = crud.readview('foo')
local objects = {}
for _, object in foo:pairs('customers', conditions, {use_tomap = true}) do
table.insert(objects, object)
Expand All @@ -262,7 +262,7 @@ pgroup.test_le_condition_with_index_readview = function(g)
local conditions, after = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {after = after, use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -274,7 +274,7 @@ pgroup.test_le_condition_with_index_readview = function(g)
t.assert_equals(objects, helpers.get_objects_by_idxs(customers, {1})) -- in age order
end

pgroup.test_first_readview = function(g)
pgroup.test_first = function(g)
local customers = helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand All @@ -294,7 +294,7 @@ pgroup.test_first_readview = function(g)
local objects, err = g.cluster.main_server.net_box:eval([[
local crud = require('crud')
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', nil, {first = 2, use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -307,7 +307,7 @@ pgroup.test_first_readview = function(g)
local tuples, err = g.cluster.main_server.net_box:eval([[
local crud = require('crud')
local tuples = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, tuple in foo:pairs('customers', nil, {first = 2}) do
table.insert(tuples, tuple)
end
Expand All @@ -321,7 +321,7 @@ pgroup.test_first_readview = function(g)
})
end

pgroup.test_negative_first_readview = function(g)
pgroup.test_negative_first = function(g)
local customers = helpers.insert_objects(g, 'customers',{
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand All @@ -341,18 +341,18 @@ pgroup.test_negative_first_readview = function(g)
t.assert_error_msg_contains("Negative first isn't allowed for pairs", function()
g.cluster.main_server.net_box:eval([[
local crud = require('crud')
foo = crud.readview('foo')
local foo = crud.readview('foo')
foo:pairs('customers', nil, {first = -10})
foo:close()
]])
end)
end

pgroup.test_empty_space_readview = function(g)
pgroup.test_empty_space = function(g)
local count = g.cluster.main_server.net_box:eval([[
local crud = require('crud')
local count = 0
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers') do
count = count + 1
end
Expand All @@ -362,7 +362,7 @@ pgroup.test_empty_space_readview = function(g)
t.assert_equals(count, 0)
end

pgroup.test_luafun_compatibility_readview = function(g)
pgroup.test_luafun_compatibility = function(g)
helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand All @@ -377,7 +377,7 @@ pgroup.test_luafun_compatibility_readview = function(g)
})
local count = g.cluster.main_server.net_box:eval([[
local crud = require('crud')
foo = crud.readview('foo')
local foo = crud.readview('foo')
local count = foo:pairs('customers'):map(function() return 1 end):sum()
foo:close()
return count
Expand All @@ -386,7 +386,7 @@ pgroup.test_luafun_compatibility_readview = function(g)

count = g.cluster.main_server.net_box:eval([[
local crud = require('crud')
foo = crud.readview('foo')
local foo = crud.readview('foo')
local count = foo:pairs('customers',
{use_tomap = true}):map(function() return 1 end):sum()
foo:close()
Expand All @@ -395,7 +395,7 @@ pgroup.test_luafun_compatibility_readview = function(g)
t.assert_equals(count, 3)
end

pgroup.test_pairs_partial_result_readview = function(g)
pgroup.test_pairs_partial_result = function(g)
helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand Down Expand Up @@ -432,7 +432,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true, fields = fields}) do
table.insert(objects, object)
end
Expand All @@ -453,7 +453,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local tuples = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, tuple in foo:pairs('customers', conditions, {fields = fields}) do
table.insert(tuples, tuple)
end
Expand Down Expand Up @@ -484,7 +484,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true, fields = fields}) do
table.insert(objects, object)
end
Expand All @@ -505,7 +505,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local tuples = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, tuple in foo:pairs('customers', conditions, {fields = fields}) do
table.insert(tuples, tuple)
end
Expand Down Expand Up @@ -539,7 +539,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true, fields = fields}) do
table.insert(objects, object)
end
Expand All @@ -560,7 +560,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local tuples = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, tuple in foo:pairs('customers', conditions, {fields = fields}) do
table.insert(tuples, tuple)
end
Expand Down Expand Up @@ -592,7 +592,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true, fields = fields}) do
table.insert(objects, object)
Expand All @@ -615,7 +615,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
local conditions, fields = ...
local tuples = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, tuple in foo:pairs('customers', conditions, {fields = fields}) do
table.insert(tuples, tuple)
end
Expand All @@ -631,7 +631,7 @@ pgroup.test_pairs_partial_result_readview = function(g)
t.assert_equals(objects, expected_customers)
end

pgroup.test_pairs_force_map_call_readview = function(g)
pgroup.test_pairs_force_map_call = function(g)
local key = 1

local first_bucket_id = g.cluster.main_server.net_box:eval([[
Expand Down Expand Up @@ -665,7 +665,7 @@ pgroup.test_pairs_force_map_call_readview = function(g)
local conditions = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true}) do
table.insert(objects, object)
end
Expand All @@ -683,7 +683,7 @@ pgroup.test_pairs_force_map_call_readview = function(g)
local conditions = ...
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', conditions, {use_tomap = true, force_map_call = true}) do
table.insert(objects, object)
end
Expand All @@ -695,7 +695,7 @@ pgroup.test_pairs_force_map_call_readview = function(g)
t.assert_equals(objects, customers)
end

pgroup.test_pairs_timeout_readview = function(g)
pgroup.test_pairs_timeout = function(g)
local customers = helpers.insert_objects(g, 'customers', {
{
id = 1, name = "Elizabeth", last_name = "Jackson",
Expand Down Expand Up @@ -725,7 +725,7 @@ pgroup.test_pairs_timeout_readview = function(g)
local crud = require('crud')
local objects = {}
foo = crud.readview('foo')
local foo = crud.readview('foo')
for _, object in foo:pairs('customers', nil, {timeout = 1}) do
table.insert(objects, object)
end
Expand All @@ -738,7 +738,7 @@ end

-- gh-220: bucket_id argument is ignored when it cannot be deduced
-- from provided select/pairs conditions.
pgroup.test_pairs_no_map_reduce_readview = function(g)
pgroup.test_pairs_no_map_reduce = function(g)
local customers = helpers.insert_objects(g, 'customers', {
{
-- bucket_id is 477, storage is s-2
Expand Down Expand Up @@ -767,7 +767,7 @@ pgroup.test_pairs_no_map_reduce_readview = function(g)
-- Case: no conditions, just bucket id.
local rows = router:eval([[
local crud = require('crud')
foo = crud.readview('foo')
local foo = crud.readview('foo')
local rows = foo:pairs(...):totable()
foo:close()
Expand All @@ -789,7 +789,7 @@ pgroup.test_pairs_no_map_reduce_readview = function(g)
-- index (primary index in the case).
local rows = g.cluster.main_server.net_box:eval([[
local crud = require('crud')
foo = crud.readview('foo')
local foo = crud.readview('foo')
local rows = foo:pairs(...):totable()
foo:close()
return rows
Expand Down
Loading

0 comments on commit c274763

Please sign in to comment.