Skip to content
Snippets Groups Projects
Commit 8880131e authored by bigbes's avatar bigbes Committed by Roman Tsisyk
Browse files

Refix tarantoolctl test again

parent b8890069
No related branches found
No related tags found
No related merge requests found
......@@ -346,7 +346,7 @@ local function client_handler(client, peer)
print = client_print;
client = client;
}, repl_mt)
local version = _TARANTOOL
local version = _TARANTOOL:match("([^-]+)-")
state:print(string.format("%-63s\n%-63s\n",
"Tarantool ".. version.." (Lua console)",
"type 'help' for interactive help"))
......
Subproject commit 886577172b82073b33d8a23a7f7555a85e6c146e
Subproject commit ab8b33ccbe4f11021acebbcb7909efa3b5e8e5d7
......@@ -81,13 +81,39 @@ local function run_command(dir, command)
local line = [[/bin/sh -c 'cd "%s" && %s >"%s" 2>"%s"']]
line = line:format(dir, command, fstdout, fstderr)
local res = os.execute(line)
fiber.sleep(0.1)
local fstdout_e, fstderr_e = io.open(fstdout):read('*a'), io.open(fstderr):read('*a')
fio.unlink(fstdout); fio.unlink(fstderr);
return res/256, fstdout_e, fstderr_e
end
local function tctl_command(dir, cmd, args)
local function tctl_wait(dir, name)
if name then
local path = fio.pathjoin(dir, name .. '.control')
while not fio.stat(path) do
fiber.sleep(0.01)
end
::again::
while true do
local stat, nb = pcall(require('net.box').new, path, {
wait_connected = true, console = true
})
if stat == false then
fiber.sleep(0.01)
goto again
else
break
end
local stat, msg = pcall(nb.eval, nb, 'require("fiber").time()')
if stat == false then
fiber.sleep(0.01)
else
break
end
end
end
end
local function tctl_command(dir, cmd, args, name)
local pid = nil
if not fio.stat(fio.pathjoin(dir, '.tarantoolctl')) then
create_script(dir, '.tarantoolctl', tctlcfg_code)
......@@ -173,7 +199,7 @@ do
check_ok(test_i, dir, 'start', 'bad_script', 1, nil,
'unexpected symbol near')
check_ok(test_i, dir, 'start', 'good_script', 0)
fiber.sleep(0.1)
tctl_wait(dir, 'good_script')
-- wait here
check_ok(test_i, dir, 'eval', 'good_script bad_script.lua', 3,
nil, 'Error, while reloading config:')
......@@ -205,7 +231,7 @@ do
test:test("check answers in case of call", function(test_i)
test_i:plan(6)
check_ok(test_i, dir, 'start', 'good_script', 0)
fiber.sleep(0.1)
tctl_wait(dir, 'good_script')
check_ok(test_i, dir, 'eval', 'good_script bad_script.lua', 3, nil,
'Error, while reloading config')
check_ok(test_i, dir, 'eval', 'good_script ok_script.lua', 0,
......@@ -324,7 +350,7 @@ do
local dir = fio.tempdir()
local filler_code = [[
box.cfg{slab_alloc_arena = 0.1}
box.cfg{slab_alloc_arena = 0.1, background=false}
local space = box.schema.create_space("test")
space:create_index("primary")
space:insert({[1] = 1, [2] = 2, [3] = 3, [4] = 4})
......@@ -361,7 +387,6 @@ do
test:test("fill and test play output", function(test_i)
test_i:plan(6)
check_ok(test_i, dir, 'start', 'filler', 0)
fiber.sleep(0.01)
local lsn_before = test_run:get_lsn("remote", 1)
test_i:is(lsn_before, 4, "check lsn before")
local res, stdout, stderr = run_command(dir, command_base)
......
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