Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH v1 1/1] test: fix test sql/func-recreate.test.lua
@ 2020-04-22 11:18 imeevma
  0 siblings, 0 replies; only message in thread
From: imeevma @ 2020-04-22 11:18 UTC (permalink / raw)
  To: korablev, tarantool-patches

After commit d4a7459e79, this test does not work properly. The
main purpose of this test at the time of creation was to show that
if an error occurred while creating the SQL function, the user
would be able to see this error. After the commit, the error
disappeared from this test.

The patch modifies the test, indicating that the error will be
shown to the user.

Follow-up #4384
---
https://github.com/tarantool/tarantool/issues/4384
https://github.com/tarantool/tarantool/tree/imeevma/gh-4384-fix-test-func-recreate-2.3

@ChangeLog
 - Test sql/func-recreate.test.lua now works as intended (gh-4384).

 test/sql/func-recreate.result   | 50 +++++------------------------------------
 test/sql/func-recreate.test.lua | 28 ++++-------------------
 2 files changed, 10 insertions(+), 68 deletions(-)

diff --git a/test/sql/func-recreate.result b/test/sql/func-recreate.result
index 3709df7..eaefe61 100644
--- a/test/sql/func-recreate.result
+++ b/test/sql/func-recreate.result
@@ -8,64 +8,26 @@ _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 ---
 ...
 -- Check errors during function create process
-fiber = require('fiber')
----
-...
 test_run:cmd("setopt delimiter ';'")
 ---
 - true
 ...
 box.schema.func.create('WAITFOR', {language = 'Lua',
-                       body = 'function (n) fiber.sleep(n) return n end',
+                       body = 'function (n) return n end',
                        param_list = {'number'}, returns = 'number',
-                       exports = {'LUA', 'SQL'}})
-test_run:cmd("setopt delimiter ''");
----
-...
-ch = fiber.channel(1)
----
-...
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
----
-...
-fiber.sleep(0.1)
----
-...
-box.func.WAITFOR:drop()
----
-...
-test_run:cmd("setopt delimiter ';'")
+                       exports = {'LUA', 'SQL'}});
 ---
-- true
 ...
 box.schema.func.create('WAITFOR', {language = 'Lua',
-                       body = 'function (n) fiber.sleep(n) return n end',
+                       body = 'function (n) return n end',
                        param_list = {'number'}, returns = 'number',
-                       exports = {'LUA', 'SQL'}})
-test_run:cmd("setopt delimiter ''");
----
-...
-ch:get()
----
-- metadata:
-  - name: WAITFOR(0.2)
-    type: number
-  rows:
-  - [0.2]
-...
-box.func.WAITFOR:drop()
+                       exports = {'LUA', 'SQL'}});
 ---
+- error: Function 'WAITFOR' already exists
 ...
-test_run:cmd("setopt delimiter ';'")
----
-- true
-...
-box.schema.func.create('WAITFOR', {language = 'Lua',
-                   body = 'function (n) fiber.sleep(n) return n end',
-                   param_list = {'number'}, returns = 'number',
-                   exports = {'LUA', 'SQL'}})
 test_run:cmd("setopt delimiter ''");
 ---
+- true
 ...
 box.func.WAITFOR:drop()
 ---
diff --git a/test/sql/func-recreate.test.lua b/test/sql/func-recreate.test.lua
index b76789f..10f1ac7 100644
--- a/test/sql/func-recreate.test.lua
+++ b/test/sql/func-recreate.test.lua
@@ -3,35 +3,15 @@ engine = test_run:get_cfg('engine')
 _ = box.space._session_settings:update('sql_default_engine', {{'=', 2, engine}})
 
 -- Check errors during function create process
-fiber = require('fiber')
 test_run:cmd("setopt delimiter ';'")
 box.schema.func.create('WAITFOR', {language = 'Lua',
-                       body = 'function (n) fiber.sleep(n) return n end',
+                       body = 'function (n) return n end',
                        param_list = {'number'}, returns = 'number',
-                       exports = {'LUA', 'SQL'}})
-test_run:cmd("setopt delimiter ''");
-
-ch = fiber.channel(1)
-
-_ = fiber.create(function () ch:put(box.execute('select WAITFOR(0.2)')) end)
-fiber.sleep(0.1)
-
-box.func.WAITFOR:drop()
-
-test_run:cmd("setopt delimiter ';'")
+                       exports = {'LUA', 'SQL'}});
 box.schema.func.create('WAITFOR', {language = 'Lua',
-                       body = 'function (n) fiber.sleep(n) return n end',
+                       body = 'function (n) return n end',
                        param_list = {'number'}, returns = 'number',
-                       exports = {'LUA', 'SQL'}})
-test_run:cmd("setopt delimiter ''");
-ch:get()
-box.func.WAITFOR:drop()
-
-test_run:cmd("setopt delimiter ';'")
-box.schema.func.create('WAITFOR', {language = 'Lua',
-                   body = 'function (n) fiber.sleep(n) return n end',
-                   param_list = {'number'}, returns = 'number',
-                   exports = {'LUA', 'SQL'}})
+                       exports = {'LUA', 'SQL'}});
 test_run:cmd("setopt delimiter ''");
 
 box.func.WAITFOR:drop()
-- 
2.7.4

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-22 11:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-22 11:18 [Tarantool-patches] [PATCH v1 1/1] test: fix test sql/func-recreate.test.lua imeevma

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