From dc5edaa4ce5f75a3d2d69fef40c3c226ef7d12a4 Mon Sep 17 00:00:00 2001 From: Pavel Balaev <balaev@tarantool.org> Date: Tue, 10 Oct 2023 12:50:52 +0300 Subject: [PATCH] tarantoolctl: fix luarocks warnings issue This patch fixes issue: $ tarantoolctl rocks --version 1>/dev/null Warning: failed to load command module luarocks.cmd.help NO_DOC=bugfix NO_CHANGELOG=not released yet (cherry picked from commit d6ae403e99cc20d816e59f8fba8f7350e44b9217) --- extra/dist/tarantoolctl.in | 2 +- test/app-tap/tarantoolctl.test.lua | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/extra/dist/tarantoolctl.in b/extra/dist/tarantoolctl.in index b093fd907d..2e1985092e 100755 --- a/extra/dist/tarantoolctl.in +++ b/extra/dist/tarantoolctl.in @@ -958,7 +958,7 @@ local function rocks() config = "luarocks.cmd.config", doc = "luarocks.cmd.doc", download = "luarocks.cmd.download", - help = "luarocks.cmd.help", + help = pcall(require, "luarocks.cmd.help") and "luarocks.cmd.help" or nil, init = "luarocks.cmd.init", install = "luarocks.cmd.install", lint = "luarocks.cmd.lint", diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua index c2c41cb7c2..ff2f80db72 100755 --- a/test/app-tap/tarantoolctl.test.lua +++ b/test/app-tap/tarantoolctl.test.lua @@ -176,7 +176,7 @@ local function merge(...) end local test = tap.test('tarantoolctl') -test:plan(8) +test:plan(9) -- basic start/stop test -- must be stopped afterwards @@ -353,6 +353,18 @@ do test_help(test_i, dir, "tarantoolctl", "Usage:") check_ok(test_i, dir, "rocks", "--help", 0, "Usage:") end) + test:test("check no luarocks warnings issues", function(test_i) + test_i:plan(1) + local _, _, stderr = tctl_command(dir, "rocks", "--version") + local warnings = 0 + for _, line in pairs(string.split(stderr, '\n')) do + if line:match('[Ww]arning:') then + warnings = warnings + 1 + end + end + + test_i:is(warnings, 0, 'no warnings issued') + end) end) recursive_rmdir(dir) -- GitLab