Skip to content

Commit bd94603

Browse files
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
1 parent d7cbc12 commit bd94603

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

test/suites/lib/tarantool_python_ci.lua

+23-7
Original file line numberDiff line numberDiff line change
@@ -179,18 +179,33 @@ clean = function()
179179
end)
180180

181181
local _FUNC_NAME = 3
182+
local _FUNC_LANGUAGE = 5
182183
local allowed_funcs = {
183184
['box.schema.user.info'] = true,
184185
}
186+
local allowed_langs = {
187+
['SQL_BUILTIN'] = true,
188+
}
185189
box.space._func:pairs():map(function(tuple)
186190
local name = tuple[_FUNC_NAME]
187-
return name
188-
end):filter(function(name)
189-
return not allowed_funcs[name]
190-
end):each(function(name)
191-
box.schema.func.drop(name)
191+
local lang = tuple[_FUNC_LANGUAGE]
192+
return { name = name, lang = lang }
193+
end):filter(function(prop)
194+
return not allowed_funcs[prop.name]
195+
end):filter(function(prop)
196+
return not allowed_langs[prop.lang]
197+
end):each(function(prop)
198+
box.schema.func.drop(prop.name)
192199
end)
193200

201+
local sql_builtin_func_count = box.space._func:pairs():map(function(tuple)
202+
local lang = tuple[_FUNC_LANGUAGE]
203+
if lang == 'SQL_BUILTIN' then
204+
return 1
205+
end
206+
return 0
207+
end):sum()
208+
194209
cleanup_cluster()
195210

196211
local cleanup_list = function(list, allowed)
@@ -333,8 +348,9 @@ clean = function()
333348
local user_count = box.space._user:count()
334349
assert(user_count == 4 or user_count == 5,
335350
'box.space._user:count() should be 4 (1.10) or 5 (2.0)')
336-
assert(box.space._func:count() == 1,
337-
'box.space._func:count() should be only one')
351+
assert(box.space._func:count() == 1 + sql_builtin_func_count,
352+
'box.space._func:count() should be 1 (1.10 and >= 2.10)' ..
353+
' or 1 + count of SQL_BUILTIN functions (>= 2.2.1, < 2.10)')
338354
assert(box.space._cluster:count() == 1,
339355
'box.space._cluster:count() should be only one')
340356

0 commit comments

Comments
 (0)