From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp50.i.mail.ru (smtp50.i.mail.ru [94.100.177.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D0FE84696C3 for ; Wed, 22 Apr 2020 14:18:33 +0300 (MSK) From: imeevma@tarantool.org Date: Wed, 22 Apr 2020 14:18:31 +0300 Message-Id: Subject: [Tarantool-patches] [PATCH v1 1/1] test: fix test sql/func-recreate.test.lua List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: korablev@tarantool.org, tarantool-patches@dev.tarantool.org 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