-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to set cluster cookie hash in membership
- Loading branch information
1 parent
b869dbb
commit c7bc9c9
Showing
5 changed files
with
129 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,4 @@ sandbox.lua | |
*.xlog | ||
*.snap | ||
package.json | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
local fio = require('fio') | ||
local digest = require('digest') | ||
local t = require('luatest') | ||
local g = t.group() | ||
|
||
local helpers = require('test.helper') | ||
|
||
g.before_all = function() | ||
local cookie = digest.urandom(16):hex() | ||
|
||
g.cluster1 = helpers.Cluster:new({ | ||
datadir = fio.tempdir(), | ||
server_command = helpers.entrypoint('srv_basic'), | ||
cookie = cookie..'a', | ||
replicasets = { | ||
{ | ||
alias = 'master', | ||
uuid = helpers.uuid('a'), | ||
roles = {}, | ||
servers = {{ | ||
http_port = 8081, | ||
advertise_port = 13301, | ||
instance_uuid = helpers.uuid('a', 'a', 1) | ||
}}, | ||
} | ||
}, | ||
env = { | ||
TARANTOOL_SET_COOKIE_HASH_MEMBERSHIP = 'true', | ||
} | ||
}) | ||
|
||
g.cluster1:start() | ||
|
||
g.cluster2 = helpers.Cluster:new({ | ||
datadir = fio.tempdir(), | ||
server_command = helpers.entrypoint('srv_basic'), | ||
cookie = cookie..'b', | ||
replicasets = { | ||
{ | ||
alias = 'master', | ||
uuid = helpers.uuid('b'), | ||
roles = {}, | ||
servers = {{ | ||
http_port = 8082, | ||
advertise_port = 13302, | ||
instance_uuid = helpers.uuid('b', 'b', 1) | ||
}}, | ||
} | ||
}, | ||
env = { | ||
TARANTOOL_SET_COOKIE_HASH_MEMBERSHIP = 'true', | ||
} | ||
}) | ||
|
||
g.cluster2.servers[1]:start() | ||
-- this instance is seen by the first cluster | ||
-- because of membership encryption key | ||
-- ignores keys with lenght > 32 symbols | ||
-- setting TARANTOOL_SET_COOKIE_HASH_MEMBERSHIP to true | ||
-- fixes this bug | ||
end | ||
|
||
g.after_all = function() | ||
g.cluster1:stop() | ||
fio.rmtree(g.cluster1.datadir) | ||
g.cluster2:stop() | ||
fio.rmtree(g.cluster2.datadir) | ||
end | ||
|
||
function g.test_two_clusters() | ||
local res = g.cluster1.main_server:exec(function() | ||
local members = require('membership').members() | ||
return members['localhost:13302'] | ||
end) | ||
t.assert_not(res) | ||
end |