Skip to content

Commit

Permalink
Add stateboard defaults (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steap2448 authored Jan 15, 2021
1 parent 490f00c commit 63235d9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
13 changes: 13 additions & 0 deletions cartridge/topology.lua
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,19 @@ local function get_failover_params(topology_cfg)
-- because stateful failover itself wasn't implemented yet
end

-- Enrich tarantool params with defaults
if ret.tarantool_params == nil then
ret.tarantool_params = {}
end

if ret.tarantool_params.uri == nil then
ret.tarantool_params.uri = 'tcp://localhost:4401'
end

if ret.tarantool_params.password == nil then
ret.tarantool_params.password = ''
end

-- Enrich etcd2 params with defaults
if ret.etcd2_params == nil then
ret.etcd2_params = {}
Expand Down
2 changes: 1 addition & 1 deletion instances.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ cartridge.srv-5:

cartridge-stateboard:
workdir: ./dev/stateboard
password: qwerty
password: ''
listen: 4401
8 changes: 6 additions & 2 deletions test/compatibility/config_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,15 @@ function g.test_failover_2_0_1_78()
mode
state_provider
tarantool_params {}
etcd2_params {}
}}
}]]}).data.cluster.failover_params

t.assert_equals(failover_params, {
mode = 'eventual',
state_provider = box.NULL,
tarantool_params = box.NULL,
tarantool_params = {},
etcd2_params = {},
})
end

Expand Down Expand Up @@ -133,12 +135,14 @@ function g.test_failover_2_0_1_95()
mode
state_provider
tarantool_params {}
etcd2_params {}
}}
}]]}).data.cluster.failover_params

t.assert_equals(failover_params, {
mode = 'eventual',
state_provider = box.NULL,
tarantool_params = box.NULL,
tarantool_params = {},
etcd2_params = {},
})
end
10 changes: 9 additions & 1 deletion test/integration/failover_eventual_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ g.test_api_failover = function()
set_failover_params, {etcd2_params = {endpoints = {'%^&*'}}}
)

local tarantool_defaults = {
uri = 'tcp://localhost:4401',
password = '',
}

local etcd2_params = {
prefix = '/',
lock_delay = 10,
Expand All @@ -376,6 +381,7 @@ g.test_api_failover = function()
}), {
mode = 'eventual',
failover_timeout = 0,
tarantool_params = tarantool_defaults,
etcd2_params = {
prefix = 'kv',
lock_delay = 36.6,
Expand All @@ -397,6 +403,7 @@ g.test_api_failover = function()
}), {
mode = 'eventual',
failover_timeout = 0,
tarantool_params = tarantool_defaults,
etcd2_params = {
prefix = '/',
lock_delay = 10,
Expand All @@ -415,6 +422,7 @@ g.test_api_failover = function()
{
mode = 'eventual',
failover_timeout = 0,
tarantool_params = tarantool_defaults,
etcd2_params = etcd2_params,
fencing_enabled = false,
fencing_timeout = 4,
Expand Down Expand Up @@ -514,8 +522,8 @@ g.test_api_failover = function()
mode = 'disabled',
state_provider = 'tarantool',
failover_timeout = 3,
tarantool_params = tarantool_params,
etcd2_params = etcd2_defaults,
tarantool_params = tarantool_params,
fencing_enabled = false,
fencing_timeout = 4,
fencing_pause = 2,
Expand Down
3 changes: 2 additions & 1 deletion webui/cypress/integration/failover.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,15 @@ describe('Failover', () => {
cy.get('button[label="State provider"]').contains('Tarantool (stateboard)').click();
cy.get('.meta-test__StateProvider__Dropdown *:contains(Tarantool (stateboard))');
cy.get('.meta-test__StateProvider__Dropdown *:contains(Etcd)');
cy.get('.meta-test__stateboardURI input').should('have.value', '');
cy.get('.meta-test__stateboardURI input').should('have.value', 'tcp://localhost:4401');
cy.get('.meta-test__stateboardPassword input').should('have.value', '');
//error failover_timeout must be greater than fencing_timeout
cy.get('.meta-test__SubmitButton').click();
cy.get('.meta-test__inlineError span').should('have.text',
'topology_new.failover.failover_timeout must be greater than fencing_timeout'
);
//error Invalid URI ""
cy.get('.meta-test__stateboardURI input').type('{selectAll}{del}');
cy.get('.meta-test__fencingTimeout input').type('{selectAll}{del}4');
cy.get('.meta-test__SubmitButton').click();
cy.get('.meta-test__inlineError span').should('have.text',
Expand Down

0 comments on commit 63235d9

Please sign in to comment.