Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH] test: fix app-tap/tarantoolctl sporadic failure
@ 2018-08-16 15:24 Serge Petrenko
  2018-08-16 19:42 ` Vladimir Davydov
  0 siblings, 1 reply; 4+ messages in thread
From: Serge Petrenko @ 2018-08-16 15:24 UTC (permalink / raw)
  To: vdavydov.dev; +Cc: tarantool-patches, Serge Petrenko

In rare cases this test failed on `tarantoolctl status` after
`tarantoolctl stop` due to `tarantoolctl stop` taking too much time to
unlink pid file. Fix this by waiting for pid file deletion in test.

Closes #3557
---
https://github.com/tarantool/tarantool/issues/3557
https://github.com/tarantool/tarantool/tree/sp/gh-3557-tarantoolctl-test-fix


 test/app-tap/tarantoolctl.test.lua | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/test/app-tap/tarantoolctl.test.lua b/test/app-tap/tarantoolctl.test.lua
index 6946c8312..83a8bfc37 100755
--- a/test/app-tap/tarantoolctl.test.lua
+++ b/test/app-tap/tarantoolctl.test.lua
@@ -34,6 +34,13 @@ local function recursive_rmdir(path)
     end
 end
 
+local function wait_delete(path)
+    path = fio.abspath(path)
+    while fio.path.exists(path) do
+	fiber.sleep(0.0001)
+    end
+end
+
 ffi.cdef[[
 typedef int32_t pid_t;
 int kill(pid_t pid, int sig);
@@ -157,6 +164,7 @@ test:plan(6)
 do
     local dir = fio.tempdir()
     local code = [[ box.cfg{memtx_memory = 104857600} ]]
+    local pid_path = fio.pathjoin(dir, 'script.pid')
     create_script(dir, 'script.lua', code)
 
     local status, err = pcall(function()
@@ -168,6 +176,7 @@ do
             check_ok(test_i, dir, 'start',  'script', 1, nil, "is already running")
             check_ok(test_i, dir, 'status', 'script', 0, nil, "is running")
             check_ok(test_i, dir, 'stop',   'script', 0, nil, "Stopping")
+            wait_delete(pid_path)
             check_ok(test_i, dir, 'status', 'script', 1, nil, "is stopped")
             check_ok(test_i, dir, 'stop',   'script', 0, nil, "is not running")
             check_ok(test_i, dir, 'status', 'script', 1, nil, "is stopped" )
-- 
2.15.2 (Apple Git-101.1)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-08-17  8:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-16 15:24 [PATCH] test: fix app-tap/tarantoolctl sporadic failure Serge Petrenko
2018-08-16 19:42 ` Vladimir Davydov
2018-08-17  6:47   ` [tarantool-patches] " Serge Petrenko
2018-08-17  8:32     ` Vladimir Davydov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox