Skip to content
6 changes: 3 additions & 3 deletions test/doc/playground_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ end

local cases = {
test_select_customers = {
request = "crud.select('customers', {{'<=', 'age', 35}}, {first = 10})",
request = "crud.select('customers', {{'<=', 'age', 35}}, {first = 10, mode = 'write'})",
retval_1 = {
metadata = {
{name = 'id', type = 'unsigned'},
Expand All @@ -79,7 +79,7 @@ local cases = {
}
},
test_select_developers = {
request = "crud.select('developers', nil, {first = 6})",
request = "crud.select('developers', nil, {first = 6, mode = 'write'})",
retval_1 = {
metadata = {
{name = 'id', type = 'unsigned'},
Expand Down Expand Up @@ -117,7 +117,7 @@ local cases = {
test_error = {
request = [[
do
local res, err = crud.select('non_existent', nil, {first = 10})
local res, err = crud.select('non_existent', nil, {first = 10, mode = 'write'})
return res, err and err.err or nil
end
]],
Expand Down
6 changes: 5 additions & 1 deletion test/entrypoint/srv_batch_operations/cartridge_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require('strict').on()
_G.is_initialized = function() return false end

local fio = require('fio')
local log = require('log')
local errors = require('errors')
local cartridge = require('cartridge')
Expand All @@ -13,10 +14,13 @@ else
package.path = package.path .. debug.sourcedir() .. "/?.lua;"
end

local root = fio.dirname(fio.dirname(fio.dirname(debug.sourcedir())))
package.path = package.path .. root .. "/?.lua;"

package.preload['customers-storage'] = function()
return {
role_name = 'customers-storage',
init = require('storage_init'),
init = require('storage').init,
}
end

Expand Down
52 changes: 52 additions & 0 deletions test/entrypoint/srv_batch_operations/storage.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
local helper = require('test.helper')

return {
init = helper.wrap_schema_init(function()
local engine = os.getenv('ENGINE') or 'memtx'
local customers_space = box.schema.space.create('customers', {
format = {
{name = 'id', type = 'unsigned'},
{name = 'bucket_id', type = 'unsigned'},
{name = 'name', type = 'string'},
{name = 'age', type = 'number'},
},
if_not_exists = true,
engine = engine,
})
customers_space:create_index('id', {
parts = { {field = 'id'} },
if_not_exists = true,
})
customers_space:create_index('bucket_id', {
parts = { {field = 'bucket_id'} },
unique = false,
if_not_exists = true,
})

local developers_space = box.schema.space.create('developers', {
format = {
{name = 'id', type = 'unsigned'},
{name = 'bucket_id', type = 'unsigned'},
{name = 'name', type = 'string'},
{name = 'login', type = 'string'},
},
if_not_exists = true,
engine = engine,
})
developers_space:create_index('id', {
parts = { {field = 'id'} },
if_not_exists = true,
})
developers_space:create_index('bucket_id', {
parts = { {field = 'bucket_id'} },
unique = false,
if_not_exists = true,
})
developers_space:create_index('login', {
parts = { {field = 'login'} },
unique = true,
if_not_exists = true,
})
end),
wait_until_ready = helper.wait_schema_init,
}
51 changes: 0 additions & 51 deletions test/entrypoint/srv_batch_operations/storage_init.lua

This file was deleted.

8 changes: 5 additions & 3 deletions test/entrypoint/srv_ddl/cartridge_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require('strict').on()
_G.is_initialized = function() return false end

local fio = require('fio')
local log = require('log')
local errors = require('errors')
local cartridge = require('cartridge')
Expand All @@ -13,12 +14,13 @@ else
package.path = package.path .. debug.sourcedir() .. "/?.lua;"
end

local root = fio.dirname(fio.dirname(fio.dirname(debug.sourcedir())))
package.path = package.path .. root .. "/?.lua;"

package.preload['customers-storage'] = function()
-- set sharding func in dot.notation
-- in _G for sharding func tests
return {
role_name = 'customers-storage',
init = require('storage_init'),
init = require('storage').init,
}
end

Expand Down
13 changes: 13 additions & 0 deletions test/entrypoint/srv_ddl/router.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
return {
init = function()
local some_module = {
sharding_func = function(key)
if key ~= nil and key[1] ~= nil then
return key[1] % 10
end
end
}

rawset(_G, 'some_module', some_module)
end,
}
11 changes: 0 additions & 11 deletions test/entrypoint/srv_ddl/router_init.lua

This file was deleted.

Loading