Skip to content
Snippets Groups Projects
Commit 5461326d authored by Vladimir Davydov's avatar Vladimir Davydov
Browse files

test: add skip_if_enterprise luatest helper

The helper skips a running test with luatest.skip_if in case executed by
Tarantool Enterprise. It's better than checking the package directly in
the test, because luatest.skip_if prints the reason why the test is
skipped.

NO_DOC=test
NO_CHANGELOG=test

(cherry picked from commit d2b216e8)
parent 344acf07
No related branches found
No related tags found
No related merge requests found
local tarantool = require('tarantool')
local misc = require('test.luatest_helpers.misc')
local server = require('test.luatest_helpers.server')
local t = require('luatest')
......@@ -16,9 +16,8 @@ g.after_all(function(cg)
cg.server:stop()
end)
if tarantool.package ~= 'Tarantool Enterprise' then
g.test_invalid_compression_type_during_space_creation = function(cg)
misc.skip_if_enterprise()
cg.server:exec(function(engine, compression)
local t = require('luatest')
local format = {{
......@@ -37,6 +36,7 @@ g.before_test('test_invalid_compression_type_during_setting_format', function(cg
end)
g.test_invalid_compression_type_during_setting_format = function(cg)
misc.skip_if_enterprise()
cg.server:exec(function(compression)
local t = require('luatest')
local format = {{
......@@ -57,8 +57,6 @@ g.after_test('test_invalid_compression_type_during_setting_format', function(cg)
end)
end)
end -- tarantool.package ~= 'Tarantool Enterprise'
g = t.group("none compression", t.helpers.matrix({
engine = {'memtx', 'vinyl'},
}))
......
local misc = require('test.luatest_helpers.misc')
local net = require('net.box')
local server = require('test.luatest_helpers.server')
local tarantool = require('tarantool')
local t = require('luatest')
local g = t.group()
......@@ -47,10 +47,8 @@ g.test_net_box = function()
net.connect, {g.server.net_box_uri, params = {transport = 'foo'}})
end
-- Check that SSL isn't available in open-source builds.
if tarantool.package ~= 'Tarantool Enterprise' then
g.test_listen_ssl = function()
misc.skip_if_enterprise()
g.server:exec(function()
local t = require('luatest')
t.assert_error_msg_equals(
......@@ -60,6 +58,7 @@ g.test_listen_ssl = function()
end
g.test_replication_ssl = function()
misc.skip_if_enterprise()
g.server:exec(function()
local t = require('luatest')
t.assert_error_msg_equals(
......@@ -69,9 +68,8 @@ g.test_replication_ssl = function()
end
g.test_net_box_ssl = function()
misc.skip_if_enterprise()
t.assert_error_msg_equals(
'SSL is not available in this build',
net.connect, {g.server.net_box_uri, params = {transport = 'ssl'}})
end
end -- tarantool.package ~= 'Tarantool Enterprise'
......@@ -6,11 +6,22 @@ local function is_debug_build()
return tarantool.build.target:endswith('-Debug')
end
-- Returns true if Tarantool package is Enterprise.
local function is_enterprise_package()
return tarantool.package == 'Tarantool Enterprise'
end
-- Skips a running test unless Tarantool build type is Debug.
local function skip_if_not_debug()
luatest.skip_if(not is_debug_build(), 'build type is not Debug')
end
-- Skips a running test if Tarantool package is Enterprise.
local function skip_if_enterprise()
luatest.skip_if(is_enterprise_package(), 'package is Enterprise')
end
return {
skip_if_not_debug = skip_if_not_debug,
skip_if_enterprise = skip_if_enterprise,
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment