Skip to content

Commit 1ace149

Browse files
committed
test: fix vinyl_is_broken() check
The function may return true for Tarantool 2.11. It is incorrect because the bug was fixed in 2.10: ... 1.10 1.10.11-5-g40d8f4df1 ... 2.8 2.8.2-12-g2663a9c6c 2.10 2.10.0-beta1-51-g0428bbcef master 2.10.0-beta1-51-g0428bbcef The patch fixes the problem and unifies a code that checks a support of features. Closes #103
1 parent 4a7e381 commit 1ace149

File tree

7 files changed

+51
-33
lines changed

7 files changed

+51
-33
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1313

1414
### Fixed
1515

16+
- Incorrect check of the Tarantool version in the tests to determine a bug in
17+
the vinyl engine that breaks the tests (#103).
18+
1619
## 1.3.0 - 2022-08-11
1720

1821
This release adds a Tarantool Cartridge role for expirationd package and

expirationd.lua

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ local function check_space_and_index(task)
199199
end
200200

201201
if space.engine == "memtx" and index.func ~= nil then
202-
local supported = false
203202
local version = rawget(_G, "_TARANTOOL"):split('-', 1)[1]
204203
local major_minor_patch = version:split('.', 2)
205204

@@ -208,10 +207,9 @@ local function check_space_and_index(task)
208207
local patch = tonumber(major_minor_patch[3])
209208
-- https://github.com/tarantool/expirationd/issues/101
210209
-- fixed since 2.8.4 and 2.10
211-
if (major > 2) or (major == 2 and minor == 8 and patch >= 4)
212-
or (major == 2 and minor >= 10) then
213-
supported = true
214-
end
210+
local supported = (major == 2 and minor == 8 and patch >= 4) or
211+
(major == 2 and minor >= 10) or
212+
(major >= 3)
215213
local force_allow = task.force_allow_functional_index or false
216214
if not supported and not force_allow then
217215
return false, "Functional indices are not supported for" ..

test/helper.lua

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -258,25 +258,33 @@ function helpers.tarantool_version()
258258
return major, minor, patch
259259
end
260260

261-
function helpers.vinyl_is_broken()
262-
-- Blocked by https://github.com/tarantool/tarantool/issues/6448
261+
function helpers.vinyl_is_supported()
263262
local major, minor, patch = helpers.tarantool_version()
264263

265-
-- Since Tarantool 1.10.11.
266-
local broken_v1_10 = major >= 1 and (minor > 10 or minor == 10 and patch >= 11)
267-
268-
-- Tarantool >= 2.1.0 and < 2.8.2.
269-
local broken_v2 = (major >= 2 and major < 3) and (minor >= 1 and minor < 8 or minor == 8 and patch <= 2)
270-
271-
return broken_v1_10 or broken_v2
264+
-- The issue: https://github.com/tarantool/tarantool/issues/6448
265+
--
266+
-- The problem was introduced in 1.10.2 and fixed in 1.10.12, 2.8.3 and
267+
-- after a 2.10 release.
268+
return (major == 1 and minor <= 9) or
269+
(major == 1 and minor == 10 and patch <= 1) or
270+
(major == 1 and minor == 10 and patch >= 12) or
271+
(major == 1 and minor >= 11) or
272+
(major == 2 and minor == 8 and patch >= 3) or
273+
(major == 2 and minor >= 10) or
274+
(major >= 3)
272275
end
273276

274-
function helpers.memtx_func_index_is_broken()
277+
function helpers.memtx_func_index_is_supported()
275278
local major, minor, patch = helpers.tarantool_version()
276-
if major > 2 or (major == 2 and minor == 8 and patch >= 4) or (major == 2 and minor >= 10) then
277-
return false
278-
end
279-
return true
279+
280+
-- The issue: https://github.com/tarantool/tarantool/issues/6786
281+
--
282+
-- Functional indexes for memtx storage engine are introduced in 2.2.1 with
283+
-- a bug. The 1.10 series does not support them at all. The problem was
284+
-- fixed in 2.8.4 and after a 2.10 release.
285+
return (major == 2 and minor == 8 and patch >= 4) or
286+
(major == 2 and minor >= 10) or
287+
(major >= 3)
280288
end
281289

282290
return helpers

test/unit/custom_index_test.lua

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local g = t.group('custom_index', {
1010
})
1111

1212
g.before_each({index_type = 'TREE'}, function(cg)
13-
t.skip_if(cg.params.engine == 'vinyl' and helpers.vinyl_is_broken(),
13+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
1414
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
1515
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1616
end)
@@ -197,11 +197,14 @@ function g.test_tree_index_multikey(cg)
197197
task:kill()
198198
end
199199

200-
function g.test_memtx_tree_functional_index_broken(cg)
201-
t.skip_if(_TARANTOOL < "2" or not helpers.memtx_func_index_is_broken(),
202-
"Unsupported Tarantool version")
203-
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
200+
function g.test_memtx_tree_functional_index_broken_error(cg)
204201
t.skip_if(cg.params.engine == 'vinyl', 'Unsupported engine')
202+
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
203+
t.skip_if(cg.space.index["functional_index"] == nil,
204+
"Functional indexes are not supported by Tarantool")
205+
t.skip_if(helpers.memtx_func_index_is_supported(),
206+
"Doesn't blocked by https://github.com/tarantool/tarantool/issues/6786")
207+
205208
local expected = "Functional indices are not supported for Tarantool < 2.8.4," ..
206209
" see options.force_allow_functional_index"
207210

@@ -219,10 +222,12 @@ function g.test_memtx_tree_functional_index_broken(cg)
219222
end
220223

221224
function g.test_memtx_tree_functional_index_force_broken(cg)
222-
t.skip_if(_TARANTOOL < "2" or not helpers.memtx_func_index_is_broken(),
223-
"Unsupported Tarantool version")
224-
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
225225
t.skip_if(cg.params.engine == 'vinyl', 'Unsupported engine')
226+
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
227+
t.skip_if(cg.space.index["functional_index"] == nil,
228+
"Functional indexes are not supported by Tarantool")
229+
t.skip_if(helpers.memtx_func_index_is_supported(),
230+
"Doesn't blocked byhttps://github.com/tarantool/tarantool/issues/6786")
226231

227232
helpers.iteration_result = {}
228233

@@ -252,11 +257,15 @@ function g.test_memtx_tree_functional_index_force_broken(cg)
252257
task:kill()
253258
end
254259

260+
-- Vinyl is not supported yet:
261+
-- https://github.com/tarantool/tarantool/issues/4492
255262
function g.test_memtx_tree_functional_index(cg)
256-
t.skip_if(_TARANTOOL < "2" or helpers.memtx_func_index_is_broken(),
257-
"Unsupported Tarantool version")
258-
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
259263
t.skip_if(cg.params.engine == 'vinyl', 'Unsupported engine')
264+
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
265+
t.skip_if(cg.space.index["functional_index"] == nil,
266+
"Functional indexes are not supported by Tarantool")
267+
t.skip_if(not helpers.memtx_func_index_is_supported(),
268+
"Blocked by https://github.com/tarantool/tarantool/issues/6786")
260269

261270
helpers.iteration_result = {}
262271

test/unit/expirationd_stats_test.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local g = t.group('expirationd_stats', {
1111
})
1212

1313
g.before_each({index_type = 'TREE'}, function(cg)
14-
t.skip_if(cg.params.engine == 'vinyl' and helpers.vinyl_is_broken(),
14+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
1515
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
1616
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1717
end)

test/unit/iterator_type_test.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local g = t.group('iterator_type', {
1111
})
1212

1313
g.before_each({index_type = 'TREE'}, function(cg)
14-
t.skip_if(cg.params.engine == 'vinyl' and helpers.vinyl_is_broken(),
14+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
1515
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
1616
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1717
end)

test/unit/start_key_test.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ local g = t.group('start_key', {
1010
})
1111

1212
g.before_each({index_type = 'TREE'}, function(cg)
13-
t.skip_if(cg.params.engine == 'vinyl' and helpers.vinyl_is_broken(),
13+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
1414
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
1515
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1616
end)

0 commit comments

Comments
 (0)