Skip to content
Snippets Groups Projects
Commit c9d5b345 authored by Alexander Turenko's avatar Alexander Turenko Committed by Alexander Turenko
Browse files

test/interactive: disable hide/show prompt feature

See #7169 for details about the hide/show prompt feature. In short, it
hides readline's prompt before `print()` or `log.<level>()` calls and
restores the prompt afterwards.

This feature sometimes badly interferes with
`test.interactive_tarantool` heuristics about readline's command
echoing.

This commit disables the feature in `test.interactive_tarantool` by
default and enables it explicitly where needed.

Part of #9985

NO_DOC=testing helper change
NO_CHANGELOG=see NO_DOC

(cherry picked from commit 23094b6f)
parent 73e03318
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,10 @@ local g = t.group()
-- Checks that `print` throwing an error is handled correctly.
g.test_basic_print_with_exception = function()
local child = it.new({args = {'-l', 'fiber'}})
local child = it.new({
args = {'-l', 'fiber'},
env = {TT_CONSOLE_HIDE_SHOW_PROMPT = 'true'},
})
child:execute_command([[
_ = fiber.create(function()
......
local fun = require('fun')
local server = require('luatest.server')
local treegen = require('test.treegen')
local it = require('test.interactive_tarantool')
......@@ -28,13 +27,6 @@ g.after_all(function(g)
treegen.clean(g)
end)
-- Disable hide/show prompt functionality, because it breaks a
-- command echo check. The reason is that the 'scheduled next
-- checkpoint' log message is issued from a background fiber.
local env_default = {
TT_CONSOLE_HIDE_SHOW_PROMPT = 'false',
}
g.test_json_table_curly_bracket = function()
local env = {["TT_METRICS"] = '{"labels":{"alias":"gh_8051"},' ..
'"include":"all","exclude":["vinyl"]}'}
......@@ -47,9 +39,9 @@ end
g.test_json_table_square_bracket = function(g)
g.child = it.new({
env = fun.chain(env_default, {
env = {
TT_LISTEN = '["localhost:0"]',
}):tomap(),
},
})
local command = ('box.cfg({work_dir = %q})'):format(g.dir)
......@@ -70,9 +62,9 @@ end
g.test_format_error = function(g)
g.child = it.new({
env = fun.chain(env_default, {
env = {
TT_LOG_MODULES = 'aaa=info,bbb',
}):tomap(),
},
})
local command = ('box.cfg({work_dir = %q})'):format(g.dir)
......@@ -82,9 +74,9 @@ end
g.test_format_error_empty_key = function()
g.child = it.new({
env = fun.chain(env_default, {
env = {
TT_LOG_MODULES = 'aaa=info,=error',
}):tomap(),
},
})
local command = ('box.cfg({work_dir = %q})'):format(g.dir)
......
......@@ -8,7 +8,10 @@ local g = t.group()
-- It does not check that tarantool preserves current input line
-- and cursor position.
g.test_basic_print = function()
local child = it.new({args = {'-l', 'fiber'}})
local child = it.new({
args = {'-l', 'fiber'},
env = {TT_CONSOLE_HIDE_SHOW_PROMPT = 'true'},
})
child:execute_command([[
_ = fiber.create(function()
......@@ -35,7 +38,10 @@ end
-- We don't check for presence of 'flood' lines in the log, but
-- verify that prompt on stdout is shown and hid.
g.test_basic_log = function()
local child = it.new({args = {'-l', 'fiber', '-l', 'log'}})
local child = it.new({
args = {'-l', 'fiber', '-l', 'log'},
env = {TT_CONSOLE_HIDE_SHOW_PROMPT = 'true'},
})
child:execute_command([[
_ = fiber.create(function()
......
......@@ -333,6 +333,13 @@ function M._new_internal(opts)
-- (because the command in the echo output will be
-- trimmed).
INPUTRC = '/dev/null',
-- Disable hide/show prompt functionality, because it
-- may break a command echo check.
--
-- For example, it occurs on the 'scheduled next
-- checkpoint' log message, which is issued from a
-- background fiber.
TT_CONSOLE_HIDE_SHOW_PROMPT = 'false',
}, env):tomap(),
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment