Skip to content

Commit

Permalink
test: support tests with vshard
Browse files Browse the repository at this point in the history
Closes #364
  • Loading branch information
oleg-jukovec committed Oct 5, 2023
1 parent 3b9532f commit 2ca6347
Show file tree
Hide file tree
Showing 73 changed files with 3,455 additions and 1,831 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Fixed
* `crud.readview` resource cleanup on garbage collect (#379).
* Tests with Tarantool 3.0 (#364).

## [1.3.0] - 27-09-23

Expand Down
File renamed without changes.
47 changes: 47 additions & 0 deletions test/entrypoint/srv_batch_operations/storage_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
return 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
231 changes: 0 additions & 231 deletions test/entrypoint/srv_ddl.lua

This file was deleted.

40 changes: 40 additions & 0 deletions test/entrypoint/srv_ddl/cartridge_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env tarantool

require('strict').on()
_G.is_initialized = function() return false end

local log = require('log')
local errors = require('errors')
local cartridge = require('cartridge')

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'),
}
end

local ok, err = errors.pcall('CartridgeCfgError', cartridge.cfg, {
advertise_uri = 'localhost:3301',
http_port = 8081,
bucket_count = 3000,
roles = {
'customers-storage',
'cartridge.roles.crud-router',
'cartridge.roles.crud-storage',
}},
-- Increase readahead for performance tests.
-- Performance tests on HP ProBook 440 G5 16 Gb
-- bump into default readahead limit and thus not
-- give a full picture.
{ readahead = 20 * 1024 * 1024 }
)

if not ok then
log.error('%s', err)
os.exit(1)
end

_G.is_initialized = cartridge.is_healthy
11 changes: 11 additions & 0 deletions test/entrypoint/srv_ddl/router_init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
return 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
Loading

0 comments on commit 2ca6347

Please sign in to comment.