From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@dev.tarantool.org, kyukhin@tarantool.org
Subject: [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness
Date: Thu, 5 Mar 2020 22:15:17 +0100 [thread overview]
Message-ID: <4ecccbd1294ac024dfc9c05d2d7f74b908e50992.1583442898.git.v.shpilevoy@tarantool.org> (raw)
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)
next reply other threads:[~2020-03-05 21:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 21:15 Vladislav Shpilevoy [this message]
2020-03-06 15:45 ` Kirill Yukhin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4ecccbd1294ac024dfc9c05d2d7f74b908e50992.1583442898.git.v.shpilevoy@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=kyukhin@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 1/1] test: fix fio.test.lua flakiness' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox