From 8bb345b51eabb9db3678f22a52683e0734a9449a Mon Sep 17 00:00:00 2001 From: Igor Zolotarev Date: Wed, 28 Feb 2024 16:10:05 +0300 Subject: [PATCH] Fixes after review --- cartridge/lua-api/get-topology.lua | 1 + .../vshard_rebalancer_api_test.lua | 20 ++++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cartridge/lua-api/get-topology.lua b/cartridge/lua-api/get-topology.lua index 7c12ee644..1f86bc2f3 100644 --- a/cartridge/lua-api/get-topology.lua +++ b/cartridge/lua-api/get-topology.lua @@ -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) diff --git a/test/integration/vshard_rebalancer_api_test.lua b/test/integration/vshard_rebalancer_api_test.lua index 80dbdb178..e837da293 100644 --- a/test/integration/vshard_rebalancer_api_test.lua +++ b/test/integration/vshard_rebalancer_api_test.lua @@ -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 } } } @@ -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, @@ -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 + } } } } @@ -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,