Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: korablev@tarantool.org, tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 1/1] test: fix test sql/func-recreate.test.lua
Date: Wed, 22 Apr 2020 14:18:31 +0300	[thread overview]
Message-ID: <a958c520ffa3d72aa54ab82548eebf04b2a80fa9.1587554148.git.imeevma@gmail.com> (raw)

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

                 reply	other threads:[~2020-04-22 11:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=a958c520ffa3d72aa54ab82548eebf04b2a80fa9.1587554148.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 1/1] test: fix test sql/func-recreate.test.lua' \
    /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