Skip to content

Commit 7b6f167

Browse files
ImeevMATotktonada
authored andcommitted
Intoduce utils.version_current_ge_than()
This patch introduces the utils.version_current_ge_than() function, which compares the current version of Tarantool with a given version.
1 parent f21e6ec commit 7b6f167

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

luatest/replica_proxy.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ function Proxy:inherit(object)
3131
end
3232

3333
local function check_tarantool_version()
34-
local version = utils.get_tarantool_version()
35-
if utils.version_ge(version, utils.version(2, 10, 1)) then
34+
if utils.version_current_ge_than(2, 10, 1) then
3635
return
3736
else
3837
error('Proxy requires Tarantool 2.10.1 and newer')

luatest/utils.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,11 @@ function utils.version_ge(version1, version2)
182182
end
183183
end
184184

185+
function utils.version_current_ge_than(major, minor, patch)
186+
return utils.version_ge(utils.get_tarantool_version(),
187+
utils.version(major, minor, patch))
188+
end
189+
185190
function utils.is_tarantool_binary(path)
186191
return path:find('^.*/tarantool[^/]*$') ~= nil
187192
end

test/proxy_test.lua

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ local fiber = require('fiber')
99
local g = t.group('proxy-version-check')
1010

1111
g.test_proxy_errors = function()
12-
t.skip_if(utils.version_ge(utils.get_tarantool_version(),
13-
utils.version(2, 10, 1)),
12+
t.skip_if(utils.version_current_ge_than(2, 10, 1),
1413
"Proxy works on Tarantool 2.10.1+, nothing to test")
1514
t.assert_error_msg_contains('Proxy requires Tarantool 2.10.1 and newer',
1615
proxy.new, proxy, {
@@ -26,8 +25,7 @@ local g1 = t.group('proxy', {
2625

2726
g1.before_all(function(cg)
2827
-- Proxy only works on tarantool 2.10+
29-
t.run_only_if(utils.version_ge(utils.get_tarantool_version(),
30-
utils.version(2, 10, 1)),
28+
t.run_only_if(utils.version_current_ge_than(2, 10, 1),
3129
[[Proxy works on Tarantool 2.10.1+.
3230
See tarantool/tarantool@57ecb6cd90b4 for details]])
3331
cg.rs = replica_set:new{}

0 commit comments

Comments
 (0)