Tarantool development patches archive
 help / color / mirror / Atom feed
* [tarantool-patches] [PATCH] Increase time quota for selectG test on vinyl
@ 2018-07-31 20:22 Alexander Turenko
  2018-08-03 13:57 ` [tarantool-patches] " n.pettik
  2018-08-03 15:38 ` Kirill Yukhin
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Turenko @ 2018-07-31 20:22 UTC (permalink / raw)
  To: Nikita Pettik; +Cc: Alexander Turenko, tarantool-patches

The test case has execution time around 25 seconds on vinyl (while
around 5 seconds on memtx) on a slow laptop with HDD. On a modern laptop
with SSD it is ~8 seconds for vinyl and ~2-3 seconds for memtx. Both
measurement were performed with parallel run of many instances of the
test.

Also enabled ability to run a sql-tap test w/o test-run. It was broken
since b09f5964.

Fixes #3590.
---
branch: Totktonada/gh-3590-fix-sql-tap-selectG-flaky-fail
travis-ci: https://travis-ci.org/tarantool/tarantool/builds/410505565
 test/sql-tap/lua/sqltester.lua | 21 +++++++++++++++++----
 test/sql-tap/selectG.test.lua  |  7 ++++++-
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/test/sql-tap/lua/sqltester.lua b/test/sql-tap/lua/sqltester.lua
index 04138154b..8751ef820 100644
--- a/test/sql-tap/lua/sqltester.lua
+++ b/test/sql-tap/lua/sqltester.lua
@@ -3,6 +3,12 @@ local json = require('json')
 local test = tap.test("errno")
 local sql_tokenizer = require('sql_tokenizer')
 
+-- pcall here, because we allow to run a test w/o test-run; use:
+-- LUA_PATH='test/sql-tap/lua/?.lua;test/sql/lua/?.lua;;' \
+--     ./test/sql-tap/xxx.test.lua
+local ok, test_run = pcall(require, 'test_run')
+test_run = ok and test_run.new() or nil
+
 local function flatten(arr)
     local result = { }
 
@@ -411,8 +417,12 @@ test.do_eqp_test = function (self, label, sql, result)
 end
 
 setmetatable(_G, nil)
-os.execute("rm -rf $(ls -d */)")
-os.execute("rm -f *.snap *.xlog* *.vylog* *.run*")
+
+-- perform clean up only under test-run
+if test_run then
+    os.execute("rm -rf $(ls -d */)")
+    os.execute("rm -f *.snap *.xlog* *.vylog* *.run*")
+end
 
 -- start the database
 box.cfg{
@@ -421,8 +431,11 @@ box.cfg{
     log="tarantool.log";
 }
 
-test_run = require('test_run').new()
-engine = test_run:get_cfg('engine')
+local engine = test_run and test_run:get_cfg('engine') or 'memtx'
 box.sql.execute('pragma sql_default_engine=\''..engine..'\'')
 
+function test.engine(self)
+    return engine
+end
+
 return test
diff --git a/test/sql-tap/selectG.test.lua b/test/sql-tap/selectG.test.lua
index f9732658e..d83b790f1 100755
--- a/test/sql-tap/selectG.test.lua
+++ b/test/sql-tap/selectG.test.lua
@@ -27,6 +27,10 @@ testprefix = "selectG"
 -- for an O(N*N) inefficiency that was once in the code and that would make
 -- the insert run for over a minute.
 --
+local engine = test:engine()
+local time_quota =
+    engine == 'memtx' and 25 or (
+    engine == 'vinyl' and 50 or 0) -- seconds
 test:do_test(
     100,
     function()
@@ -42,7 +46,8 @@ test:do_test(
         test:execsql(sql)
         local end_time = os.time()
         -- max run time was increased because of parallel test run
-        return test:execsql( "SELECT count(x), sum(x), avg(x), "..(end_time - start_time).."<25 FROM t1;")
+        return test:execsql(("SELECT count(x), sum(x), avg(x), %d<%d FROM t1;")
+            :format(end_time - start_time, time_quota))
     end, {
         -- <100>
         100000, 5000050000, 50000.5, 1
-- 
2.17.1

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

end of thread, other threads:[~2018-08-03 15:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31 20:22 [tarantool-patches] [PATCH] Increase time quota for selectG test on vinyl Alexander Turenko
2018-08-03 13:57 ` [tarantool-patches] " n.pettik
2018-08-03 15:23   ` Alexander Turenko
2018-08-03 15:38 ` Kirill Yukhin

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