Skip to content

Commit

Permalink
Fixes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
yngvar-antonsson committed Feb 28, 2024
1 parent d1a11f4 commit 8bb345b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions cartridge/lua-api/get-topology.lua
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ local function get_topology()
servers = {},
all_rw = replicaset.all_rw or false,
alias = replicaset.alias or 'unnamed',
rebalancer = replicaset.rebalancer,
}

local enabled_roles = roles.get_enabled_roles(replicaset.roles)
Expand Down
20 changes: 17 additions & 3 deletions test/integration/vshard_rebalancer_api_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,14 @@ end
g.test_rebalancer_replicaset_level = function()
local server = g.cluster:server('A-1')

g.cluster.main_server:graphql({
local res = g.cluster.main_server:graphql({
query = [[
mutation($replicasets: [EditReplicasetInput]) {
cluster {
edit_topology(replicasets: $replicasets) {
replicasets {
uuid
rebalancer
}
}
}
Expand All @@ -93,6 +94,11 @@ g.test_rebalancer_replicaset_level = function()
}
})

t.assert_equals(
res['data']['cluster']['edit_topology']['replicasets'],
{{uuid = server.replicaset_uuid, rebalancer = true}}
)

t.assert_equals(rebalancer_enabled(g), {
-- uri, rebalancer_enabled
['localhost:13302'] = true,
Expand Down Expand Up @@ -134,11 +140,14 @@ end)

g.test_rebalancer_server_level = function()
local server = g.cluster:server('A-2')
g.cluster.main_server:graphql({query = [[
local res = g.cluster.main_server:graphql({query = [[
mutation($servers: [EditServerInput]) {
cluster {
edit_topology(servers: $servers){
servers {uuid}
servers {
uuid
rebalancer
}
}
}
}
Expand All @@ -148,6 +157,11 @@ g.test_rebalancer_server_level = function()
}
}})

t.assert_equals(
res['data']['cluster']['edit_topology']['servers'],
{{uuid = server.instance_uuid, rebalancer = true}}
)

t.assert_equals(rebalancer_enabled(g), {
-- uri, rebalancer_enabled
['localhost:13302'] = false,
Expand Down

0 comments on commit 8bb345b

Please sign in to comment.