Skip to content

Commit 2ca6347

Browse files
committed
test: support tests with vshard
Closes #364
1 parent 3b9532f commit 2ca6347

File tree

73 files changed

+3455
-1831
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+3455
-1831
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
99

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

1314
## [1.3.0] - 27-09-23
1415

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
return function()
2+
local engine = os.getenv('ENGINE') or 'memtx'
3+
local customers_space = box.schema.space.create('customers', {
4+
format = {
5+
{name = 'id', type = 'unsigned'},
6+
{name = 'bucket_id', type = 'unsigned'},
7+
{name = 'name', type = 'string'},
8+
{name = 'age', type = 'number'},
9+
},
10+
if_not_exists = true,
11+
engine = engine,
12+
})
13+
customers_space:create_index('id', {
14+
parts = { {field = 'id'} },
15+
if_not_exists = true,
16+
})
17+
customers_space:create_index('bucket_id', {
18+
parts = { {field = 'bucket_id'} },
19+
unique = false,
20+
if_not_exists = true,
21+
})
22+
23+
local developers_space = box.schema.space.create('developers', {
24+
format = {
25+
{name = 'id', type = 'unsigned'},
26+
{name = 'bucket_id', type = 'unsigned'},
27+
{name = 'name', type = 'string'},
28+
{name = 'login', type = 'string'},
29+
},
30+
if_not_exists = true,
31+
engine = engine,
32+
})
33+
developers_space:create_index('id', {
34+
parts = { {field = 'id'} },
35+
if_not_exists = true,
36+
})
37+
developers_space:create_index('bucket_id', {
38+
parts = { {field = 'bucket_id'} },
39+
unique = false,
40+
if_not_exists = true,
41+
})
42+
developers_space:create_index('login', {
43+
parts = { {field = 'login'} },
44+
unique = true,
45+
if_not_exists = true,
46+
})
47+
end

test/entrypoint/srv_ddl.lua

Lines changed: 0 additions & 231 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env tarantool
2+
3+
require('strict').on()
4+
_G.is_initialized = function() return false end
5+
6+
local log = require('log')
7+
local errors = require('errors')
8+
local cartridge = require('cartridge')
9+
10+
package.preload['customers-storage'] = function()
11+
-- set sharding func in dot.notation
12+
-- in _G for sharding func tests
13+
return {
14+
role_name = 'customers-storage',
15+
init = require('storage_init'),
16+
}
17+
end
18+
19+
local ok, err = errors.pcall('CartridgeCfgError', cartridge.cfg, {
20+
advertise_uri = 'localhost:3301',
21+
http_port = 8081,
22+
bucket_count = 3000,
23+
roles = {
24+
'customers-storage',
25+
'cartridge.roles.crud-router',
26+
'cartridge.roles.crud-storage',
27+
}},
28+
-- Increase readahead for performance tests.
29+
-- Performance tests on HP ProBook 440 G5 16 Gb
30+
-- bump into default readahead limit and thus not
31+
-- give a full picture.
32+
{ readahead = 20 * 1024 * 1024 }
33+
)
34+
35+
if not ok then
36+
log.error('%s', err)
37+
os.exit(1)
38+
end
39+
40+
_G.is_initialized = cartridge.is_healthy
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
return function()
2+
local some_module = {
3+
sharding_func =
4+
function(key)
5+
if key ~= nil and key[1] ~= nil then
6+
return key[1] % 10
7+
end
8+
end
9+
}
10+
rawset(_G, 'some_module', some_module)
11+
end

0 commit comments

Comments
 (0)