From 28f4aa87de46a8f1a5d27d78f11ccc0ae93e6bbd Mon Sep 17 00:00:00 2001 From: Nikita Zheleztsov Date: Tue, 28 Mar 2023 14:18:13 +0300 Subject: [PATCH] test: fix flaky router_test router_test.lua fails constantly on integration CI in tarantool with error 'Peer closed' after simulating unconfigured box. The reason for this problem is unclear, but the following changes fix it. It might be related to the code, luatest executes between execs (e.g. type(box.cfg) or box.cfg. = ...). Closes #403 NO_DOC=testfix --- test/router-luatest/router_test.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/router-luatest/router_test.lua b/test/router-luatest/router_test.lua index 616085f3..28a36857 100644 --- a/test/router-luatest/router_test.lua +++ b/test/router-luatest/router_test.lua @@ -469,24 +469,23 @@ g.test_enable_disable = function(g) _G.fiber_new:set_joinable(true) end, {global_cfg}) - -- emulate unconfigured box - router:exec(function() - rawset(_G, 'old_box_cfg', box.cfg) - box.cfg = function(...) return _G.old_box_cfg(...) end - end) - local err1, err2 = router:exec(function() + -- emulate unconfigured box + local old_box_cfg = box.cfg + box.cfg = function(...) return old_box_cfg(...) end + rawset(_G, 'static_router', ivshard.router.internal.routers._static_router) rawset(_G, 'new_router', ivshard.router.internal.routers.new_router) local _, err_1 = pcall(_G.static_router.info, _G.static_router) local _, err_2 = pcall(_G.new_router.info, _G.new_router) + + box.cfg = old_box_cfg return err_1, err_2 end) assert_errors_equals(err1, err2, 'box seems not to be configured') -- set box status to loading router:exec(function() - box.cfg = _G.old_box_cfg rawset(_G, 'old_box_info', box.info) box.info = {status = 'loading'} end)