Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: do not drop SQL_BUILTIN functions
SQL_BUILTIN was introduced in [1] (tarantool 2.2.1) and dropped in [2]
(tarantool 2.10.0-beta2). It is not permitted to drop SQL_BUILTIN
functions, thus, before this patch, tarantool_python_ci.lua was unable
to run with versions between 2.2.1 and 2.10.0-beta2, failing with
`ER_DROP_FUNCTION: Can't drop function 1: function is SQL built-in`.
This patch fixes this.

tarantool_python_ci.lua is used to start a tarantool instance for
Windows tests.

1. tarantool/tarantool@200a492
2. tarantool/tarantool@c49eab9

Part of #182
  • Loading branch information
DifferentialOrange committed Mar 31, 2022
commit fa087e94dd00d3b8c66a3c47fe16ef607da12aa2
30 changes: 23 additions & 7 deletions test/suites/lib/tarantool_python_ci.lua
Original file line number Diff line number Diff line change
Expand Up @@ -179,18 +179,33 @@ clean = function()
end)

local _FUNC_NAME = 3
local _FUNC_LANGUAGE = 5
local allowed_funcs = {
['box.schema.user.info'] = true,
}
local allowed_langs = {
['SQL_BUILTIN'] = true,
}
box.space._func:pairs():map(function(tuple)
local name = tuple[_FUNC_NAME]
return name
end):filter(function(name)
return not allowed_funcs[name]
end):each(function(name)
box.schema.func.drop(name)
local lang = tuple[_FUNC_LANGUAGE]
return { name = name, lang = lang }
end):filter(function(prop)
return not allowed_funcs[prop.name]
end):filter(function(prop)
return not allowed_langs[prop.lang]
end):each(function(prop)
box.schema.func.drop(prop.name)
end)

local sql_builtin_func_count = box.space._func:pairs():map(function(tuple)
local lang = tuple[_FUNC_LANGUAGE]
if lang == 'SQL_BUILTIN' then
return 1
end
return 0
end):sum()

cleanup_cluster()

local cleanup_list = function(list, allowed)
Expand Down Expand Up @@ -333,8 +348,9 @@ clean = function()
local user_count = box.space._user:count()
assert(user_count == 4 or user_count == 5,
'box.space._user:count() should be 4 (1.10) or 5 (2.0)')
assert(box.space._func:count() == 1,
'box.space._func:count() should be only one')
assert(box.space._func:count() == 1 + sql_builtin_func_count,
'box.space._func:count() should be 1 (1.10 and >= 2.10)' ..
' or 1 + count of SQL_BUILTIN functions (>= 2.2.1, < 2.10)')
assert(box.space._cluster:count() == 1,
'box.space._cluster:count() should be only one')

Expand Down