diff --git a/test/integration/expel_last_instance_test.lua b/test/integration/expel_last_instance_test.lua index 2486b96c1..09b90625c 100644 --- a/test/integration/expel_last_instance_test.lua +++ b/test/integration/expel_last_instance_test.lua @@ -27,28 +27,6 @@ g.before_all(function() g.cluster:start() g.to_be_expelled = g.cluster:server('B-1') - -- wait until all buckets are created - t.helpers.retrying({}, function() - local count = g.to_be_expelled:exec(function() - return _G.vshard.storage.buckets_count() - end) - t.assert_equals(count, 1500) - end) - - g.to_be_expelled:exec(function() - -- this fiber will exit if the bucket count is decreased - -- we'll need that to check alerts later - local fiber = require('fiber') - local before_count = _G.vshard.storage.buckets_count() - fiber.create(function() - while true do - if _G.vshard.storage.buckets_count() < before_count then - os.exit(0) - end - fiber.sleep(0.1) - end - end) - end) end) g.after_all(function() @@ -57,24 +35,18 @@ g.after_all(function() end) function g.test_expel() - g.cluster.main_server:setup_replicaset({ - weight = 0, - uuid = g.to_be_expelled.replicaset_uuid, - }) + g.cluster:wait_until_healthy() + + g.to_be_expelled:stop() g.cluster.main_server:exec(function(uuid) package.loaded.cartridge.admin_disable_servers({uuid}) end, {g.to_be_expelled.instance_uuid}) - - local router_alerts - t.helpers.retrying({}, function() - local alerts = g.cluster.main_server:exec(function() - return require('vshard').router.info().alerts - end) - t.assert_equals(#alerts, 1) - router_alerts = alerts - end) + g.cluster.main_server:setup_replicaset({ + weight = 0, + uuid = g.to_be_expelled.replicaset_uuid, + }) t.helpers.retrying({}, function() t.assert_equals( @@ -82,7 +54,7 @@ function g.test_expel() {{ level = "warning", topic = "vshard", - message = router_alerts[1][2], + message = "1500 buckets are not discovered", instance_uuid = g.cluster.main_server.instance_uuid, replicaset_uuid = g.cluster.main_server.replicaset_uuid, }} @@ -100,6 +72,8 @@ function g.test_expel() -- return g.to_be_expelled back to proceed the expel g.to_be_expelled:start() + g.cluster:wait_until_healthy() + -- enable server before expelling g.cluster.main_server:exec(function(uuid) package.loaded.cartridge.admin_enable_servers({uuid})