Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness
@ 2020-03-05 21:15 Vladislav Shpilevoy
  2020-03-06 15:45 ` Kirill Yukhin
  0 siblings, 1 reply; 2+ messages in thread
From: Vladislav Shpilevoy @ 2020-03-05 21:15 UTC (permalink / raw)
  To: tarantool-patches, kyukhin

In 89c73e64c071cb7402406bf1eb8d767d4dfe4e6e ("fio: respect
$TMPDIR in fio.tempdir(), when it is set") was added a test
checking that fio.tempdir() returns a path to a folder, stored
by a path specified in $TMPDIR environment variable.

Check was done by calling Lua returned_path:find(tmpdir_path).
If tmpdir path contained 'special' characters such as '.', it
didn't match, because string.find() takes a regular expression,
not just a string.

string.startswith() works fine.

Follow-up #4794
---
Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-4794-follow-up-test
Issue: https://github.com/tarantool/tarantool/issues/4794

 test/app/fio.result   | 6 +++---
 test/app/fio.test.lua | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/test/app/fio.result b/test/app/fio.result
index cd18ed32c..783fa4fab 100644
--- a/test/app/fio.result
+++ b/test/app/fio.result
@@ -1465,7 +1465,7 @@ cwd = fio.cwd()
 old_tmpdir = os.getenv('TMPDIR')
 ---
 ...
-tmpdir = cwd..'/tmp'
+tmpdir = cwd..'/tmp-.dot.-'
 ---
 ...
 fio.mkdir(tmpdir)
@@ -1478,7 +1478,7 @@ os.setenv('TMPDIR', tmpdir)
 dir = fio.tempdir()
 ---
 ...
-dir:find(tmpdir) ~= nil or {dir, tmpdir}
+dir:startswith(tmpdir) or {dir, tmpdir}
 ---
 - true
 ...
@@ -1503,7 +1503,7 @@ os.setenv('TMPDIR', nil)
 dir = fio.tempdir()
 ---
 ...
-dir:find('/tmp') ~= nil or dir
+dir:startswith('/tmp') or dir
 ---
 - true
 ...
diff --git a/test/app/fio.test.lua b/test/app/fio.test.lua
index 242ff08ad..6825b882f 100644
--- a/test/app/fio.test.lua
+++ b/test/app/fio.test.lua
@@ -481,11 +481,11 @@ fio.mktree('/dev/null/dir')
 cwd = fio.cwd()
 old_tmpdir = os.getenv('TMPDIR')
 
-tmpdir = cwd..'/tmp'
+tmpdir = cwd..'/tmp-.dot.-'
 fio.mkdir(tmpdir)
 os.setenv('TMPDIR', tmpdir)
 dir = fio.tempdir()
-dir:find(tmpdir) ~= nil or {dir, tmpdir}
+dir:startswith(tmpdir) or {dir, tmpdir}
 fio.stat(dir) ~= nil or fio.stat(dir)
 
 tmpdir = cwd..'/tmp2'
@@ -494,7 +494,7 @@ fio.tempdir()
 
 os.setenv('TMPDIR', nil)
 dir = fio.tempdir()
-dir:find('/tmp') ~= nil or dir
+dir:startswith('/tmp') or dir
 
 tmpdir = cwd..'/'..string.rep('t', 5000)
 os.setenv('TMPDIR', tmpdir)
-- 
2.21.1 (Apple Git-122.3)

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

* Re: [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness
  2020-03-05 21:15 [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness Vladislav Shpilevoy
@ 2020-03-06 15:45 ` Kirill Yukhin
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2020-03-06 15:45 UTC (permalink / raw)
  To: Vladislav Shpilevoy; +Cc: tarantool-patches

Hello,

On 05 мар 22:15, Vladislav Shpilevoy wrote:
> In 89c73e64c071cb7402406bf1eb8d767d4dfe4e6e ("fio: respect
> $TMPDIR in fio.tempdir(), when it is set") was added a test
> checking that fio.tempdir() returns a path to a folder, stored
> by a path specified in $TMPDIR environment variable.
> 
> Check was done by calling Lua returned_path:find(tmpdir_path).
> If tmpdir path contained 'special' characters such as '.', it
> didn't match, because string.find() takes a regular expression,
> not just a string.
> 
> string.startswith() works fine.
> 
> Follow-up #4794
> ---
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-4794-follow-up-test
> Issue: https://github.com/tarantool/tarantool/issues/4794

I've checked your patch into master as obvious.

--
Regards, Kirill Yukhin

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

end of thread, other threads:[~2020-03-06 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-05 21:15 [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness Vladislav Shpilevoy
2020-03-06 15:45 ` Kirill Yukhin

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