Skip to content
Snippets Groups Projects
Commit 27cb91a4 authored by ms.evilhat's avatar ms.evilhat
Browse files

feat(integration_test): divide test cluster to cluster with and without storage replicas

parent b873aa51
No related branches found
No related tags found
1 merge request!1414sbroad import
jaeger_agent_host: "127.0.0.1"
storage_cache_capacity: 200
executor_sharding_column: "bucket_id"
router_cache_capacity: 50
executor_waiting_timeout: 200
jaeger_agent_port: 6831
storage_cache_size_bytes: 204800
schema:
spaces:
broken_hot:
format:
- is_nullable: false
name: id
type: number
- is_nullable: false
name: reqId
type: number
- is_nullable: false
name: name
type: string
- is_nullable: false
name: department
type: string
- is_nullable: false
name: manager
type: string
- is_nullable: false
name: salary
type: number
- is_nullable: false
name: sysOp
type: number
- is_nullable: false
name: bucket_id
type: unsigned
temporary: false
engine: memtx
is_local: false
indexes:
- unique: true
parts:
- path: id
is_nullable: false
type: number
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
is_nullable: false
type: unsigned
name: bucket_id
type: TREE
sharding_key:
- id
cola_accounts_history:
format:
- type: integer
name: id
is_nullable: false
- type: integer
name: cola
is_nullable: false
- type: integer
name: colb
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: integer
name: sys_to
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- cola
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: cola
type: integer
is_nullable: false
name: cola
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
col1_col2_transactions_num_actual:
format:
- type: number
name: col1
is_nullable: false
- type: integer
name: col2
is_nullable: false
- type: integer
name: amount
is_nullable: true
- type: integer
name: account_id
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- col1
- col2
indexes:
- unique: true
parts:
- path: col1
type: number
is_nullable: false
- path: col2
type: integer
is_nullable: false
name: col1
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
col1_transactions_actual:
format:
- type: integer
name: col1
is_nullable: false
- type: integer
name: amount
is_nullable: true
- type: integer
name: account_id
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- col1
indexes:
- unique: true
parts:
- path: col1
type: integer
is_nullable: false
name: col1
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
space_simple_shard_key:
format:
- type: integer
name: id
is_nullable: false
- type: string
name: name
is_nullable: true
- type: integer
name: sysOp
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- id
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
cola_colb_accounts_actual:
format:
- type: integer
name: id
is_nullable: false
- type: integer
name: cola
is_nullable: false
- type: integer
name: colb
is_nullable: false
- type: integer
name: sys_from
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- cola
- colb
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: cola
type: integer
is_nullable: false
- path: colb
type: integer
is_nullable: false
name: cola
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
col1_col2_transactions_actual:
format:
- type: integer
name: col1
is_nullable: false
- type: integer
name: col2
is_nullable: false
- type: integer
name: amount
is_nullable: true
- type: integer
name: account_id
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- col1
- col2
indexes:
- unique: true
parts:
- path: col1
type: integer
is_nullable: false
- path: col2
type: integer
is_nullable: false
name: col1
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
t:
format:
- type: integer
name: id
is_nullable: false
- type: number
name: a
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
indexes:
- unique: true
parts:
- path: id
is_nullable: false
type: integer
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
is_nullable: true
type: unsigned
name: bucket_id
type: TREE
is_local: false
sharding_key:
- id
engine: memtx
testing_space:
format:
- type: integer
name: id
is_nullable: false
- type: string
name: name
is_nullable: false
- type: integer
name: product_units
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- id
- name
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
col1_col2_transactions_history:
format:
- type: integer
name: id
is_nullable: false
- type: integer
name: col1
is_nullable: false
- type: integer
name: col2
is_nullable: false
- type: integer
name: amount
is_nullable: true
- type: integer
name: account_id
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: integer
name: sys_to
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- col1
- col2
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: col1
type: integer
is_nullable: false
- path: col2
type: integer
is_nullable: false
name: col1
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
col1_col2_transactions_num_history:
format:
- type: number
name: id
is_nullable: false
- type: number
name: col1
is_nullable: false
- type: integer
name: col2
is_nullable: false
- type: integer
name: amount
is_nullable: true
- type: integer
name: account_id
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: integer
name: sys_to
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- col1
- col2
indexes:
- unique: true
parts:
- path: id
type: number
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: col1
type: number
is_nullable: false
- path: col2
type: integer
is_nullable: false
name: col1
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
testing_space_bucket_in_the_middle:
format:
- type: integer
name: id
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
- type: string
name: name
is_nullable: false
- type: integer
name: product_units
is_nullable: false
temporary: false
engine: memtx
is_local: false
sharding_key:
- id
- name
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
BROKEN:
format:
- is_nullable: false
name: id
type: number
- is_nullable: false
name: reqId
type: number
- is_nullable: false
name: name
type: string
- is_nullable: false
name: department
type: string
- is_nullable: false
name: manager
type: string
- is_nullable: false
name: salary
type: number
- is_nullable: false
name: sysOp
type: number
- is_nullable: false
name: bucket_id
type: unsigned
temporary: false
engine: memtx
is_local: false
sharding_key:
- id
indexes:
- unique: true
parts:
- path: id
is_nullable: false
type: number
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
is_nullable: false
type: unsigned
name: bucket_id
type: TREE
space_t1:
format:
- type: integer
name: a
is_nullable: false
- type: integer
name: b
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- a
indexes:
- unique: true
parts:
- path: a
type: integer
is_nullable: false
name: a
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
space_simple_shard_key_hist:
format:
- type: integer
name: id
is_nullable: false
- type: string
name: name
is_nullable: true
- type: integer
name: sysOp
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- id
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
col1_transactions_history:
format:
- type: integer
name: id
is_nullable: false
- type: integer
unique: false
name: col1
is_nullable: false
- type: integer
name: amount
is_nullable: true
- type: integer
name: account_id
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: integer
name: sys_to
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- col1
indexes:
- type: TREE
parts:
- path: id
type: integer
is_nullable: false
name: id
unique: true
- unique: false
parts:
- path: col1
type: integer
is_nullable: false
name: col1
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
cola_colb_accounts_history:
format:
- type: integer
name: id
is_nullable: false
- type: integer
name: cola
is_nullable: false
- type: integer
name: colb
is_nullable: false
- type: integer
name: sys_from
is_nullable: false
- type: integer
name: sys_to
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- cola
- colb
indexes:
- unique: true
parts:
- path: cola
type: integer
is_nullable: false
- path: colb
type: integer
is_nullable: false
name: cola
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
testing_space_hist:
format:
- type: integer
name: id
is_nullable: false
- type: string
name: name
is_nullable: false
- type: integer
name: product_units
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- id
- name
indexes:
- unique: true
parts:
- path: id
type: integer
is_nullable: false
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
space_for_breake_cache:
format:
- type: integer
name: id
is_nullable: false
- type: number
name: field1
is_nullable: false
- type: number
name: field2
is_nullable: false
- type: string
name: field3
is_nullable: false
- type: boolean
name: field4
is_nullable: false
- type: integer
name: field5
is_nullable: false
- type: integer
name: field6
is_nullable: false
- type: integer
name: field7
is_nullable: false
- type: integer
name: field8
is_nullable: false
- type: integer
name: field9
is_nullable: false
- type: string
name: field10
is_nullable: false
- type: string
name: field11
is_nullable: false
- type: integer
name: field12
is_nullable: false
- type: number
name: field13
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
indexes:
- unique: true
parts:
- path: id
is_nullable: false
type: integer
name: id
type: TREE
- unique: false
parts:
- path: bucket_id
is_nullable: true
type: unsigned
name: bucket_id
type: TREE
is_local: false
sharding_key:
- id
engine: vinyl
cola_accounts_actual:
format:
- type: integer
name: id
is_nullable: false
- type: integer
name: cola
is_nullable: false
- type: integer
name: colb
is_nullable: true
- type: integer
name: sys_from
is_nullable: false
- type: unsigned
name: bucket_id
is_nullable: true
temporary: false
engine: memtx
is_local: false
sharding_key:
- cola
indexes:
- unique: true
parts:
- path: cola
type: integer
is_nullable: false
name: cola
type: TREE
- unique: false
parts:
- path: bucket_id
type: unsigned
is_nullable: true
name: bucket_id
type: TREE
This diff is collapsed.
-- This file is required automatically by luatest.
-- Add common configuration here.
local fio = require('fio')
local t = require('luatest')
local cartridge_helpers = require('cartridge.test-helpers')
local config_handler = require('test.helper.config_handler')
local helper = {
cluster = nil
}
-- luacheck: ignore package
helper.root = fio.dirname(fio.abspath(package.search('init')))
helper.datadir = fio.pathjoin(helper.root, 'tmp', 'db_test')
helper.server_command = fio.pathjoin(helper.root, 'init.lua')
local config, err = config_handler.get_init_config(helper.root)
if err ~= nil then
t.fail(err)
end
helper.cluster_config = config
helper.start_test_cluster = function (cfg)
fio.rmtree(helper.datadir)
fio.mktree(helper.datadir)
helper.cluster = cartridge_helpers.Cluster:new({
server_command = helper.server_command,
datadir = helper.datadir,
use_vshard = true,
cookie='123',
replicasets = {
{
alias = "api",
uuid = cartridge_helpers.uuid('a'),
roles = {'app.roles.api'},
servers = 1,
},
{
alias = "storage-1",
uuid = cartridge_helpers.uuid("b"),
roles = { "app.roles.storage" },
all_rw = false,
servers = 2,
weight = 1
},
{
alias = "storage-2",
uuid = cartridge_helpers.uuid("c"),
roles = { "app.roles.storage" },
servers = 1,
}
}
})
helper.cluster:start()
helper.cluster:upload_config(cfg)
end
helper.stop_test_cluster = function ()
helper.cluster:stop()
end
t.before_suite(function()
helper.start_test_cluster(config)
end)
t.after_suite(function()
helper.stop_test_cluster()
end)
return helper
-- This file is required automatically by luatest.
-- Add common configuration here.
local fio = require('fio')
local t = require('luatest')
local cartridge_helpers = require('cartridge.test-helpers')
local errno = require('errno')
local config_handler = require('test.helper.config_handler')
local helper = {
cluster = nil
}
-- luacheck: ignore package
helper.root = fio.dirname(fio.abspath(package.search('init')))
helper.datadir = fio.pathjoin(helper.root, 'tmp', 'db_test')
helper.server_command = fio.pathjoin(helper.root, 'init.lua')
helper.grep_log = function(what, bytes)
local filename = fio.pathjoin(helper.root, 'tmp', 'tarantool_integration.log')
local file = fio.open(filename, {'O_RDONLY', 'O_NONBLOCK'})
local function fail(msg)
local err = errno.strerror()
if file ~= nil then
file:close()
end
error(string.format("%s: %s: %s", msg, filename, err))
end
if file == nil then
fail("Failed to open log file")
end
io.flush() -- attempt to flush stdout == log fd
local filesize = file:seek(0, 'SEEK_END')
if filesize == nil then
fail("Failed to get log file size")
end
local bytes = bytes or 65536 -- don't read whole log - it can be huge
bytes = bytes > filesize and filesize or bytes
if file:seek(-bytes, 'SEEK_END') == nil then
fail("Failed to seek log file")
end
local found, buf
repeat -- read file in chunks
local s = file:read(2048)
if s == nil then
fail("Failed to read log file")
end
local pos = 1
repeat -- split read string in lines
local endpos = string.find(s, '\n', pos)
endpos = endpos and endpos - 1 -- strip terminating \n
local line = string.sub(s, pos, endpos)
if endpos == nil and s ~= '' then
-- line doesn't end with \n or eof, append it to buffer
-- to be checked on next iteration
buf = buf or {}
table.insert(buf, line)
else
if buf ~= nil then -- prepend line with buffered data
table.insert(buf, line)
line = table.concat(buf)
buf = nil
end
if string.match(line, "Starting instance") then
found = nil -- server was restarted, reset search
else
found = string.match(line, what) or found
end
end
pos = endpos and endpos + 2 -- jump to char after \n
until pos == nil
until s == ''
file:close()
return found
end
local config, err = config_handler.get_init_config(helper.root)
if err ~= nil then
t.fail(err)
end
helper.cluster_config = config
helper.start_test_cluster = function (cfg)
fio.rmtree(helper.datadir)
fio.mktree(helper.datadir)
helper.cluster = cartridge_helpers.Cluster:new({
server_command = helper.server_command,
datadir = helper.datadir,
use_vshard = true,
cookie='123',
replicasets = {
{
alias = "api",
uuid = cartridge_helpers.uuid('a'),
roles = {'app.roles.api'},
servers = 1,
},
{
alias = "storage-1",
uuid = cartridge_helpers.uuid("b"),
roles = { "app.roles.storage" },
servers = 1,
},
{
alias = "storage-2",
uuid = cartridge_helpers.uuid("c"),
roles = { "app.roles.storage" },
servers = 1,
}
}
})
helper.cluster:start()
helper.cluster:upload_config(cfg)
end
helper.stop_test_cluster = function ()
helper.cluster:stop()
end
t.before_suite(function()
helper.start_test_cluster(config)
end)
t.after_suite(function()
helper.stop_test_cluster()
end)
return helper
local fio = require("fio")
local yaml = require("yaml")
local errno = require("errno")
local function get_init_config(path)
local config_path = fio.pathjoin(path, 'test', 'data', 'config.yml')
if not fio.path.exists(config_path) then
return nil, error(string.format("No such file: %s", config_path))
end
local file, error = fio.open(config_path, "O_RDONLY")
if error ~= nil then
return nil, error
end
local buf = {}
while true do
local val = file:read(1024)
if val == nil then
return nil, error(string.format("Failed to read from file %s: %s", config_path, errno.strerror()))
elseif val == "" then
break
end
table.insert(buf, val)
end
file:close()
local config_yml = table.concat(buf, "")
local config = yaml.decode(config_yml)
return config
end
return {
get_init_config = get_init_config,
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment