Skip to content

Commit 760b834

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 760b834

File tree

7 files changed

+62
-37
lines changed

7 files changed

+62
-37
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: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ 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(),
14-
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
13+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
14+
'Blocked by https://github.com/tarantool/tarantool/issues/6448 on ' ..
15+
'this Tarantool version')
1516
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1617
end)
1718

@@ -197,11 +198,15 @@ function g.test_tree_index_multikey(cg)
197198
task:kill()
198199
end
199200

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')
201+
function g.test_memtx_tree_functional_index_broken_error(cg)
204202
t.skip_if(cg.params.engine == 'vinyl', 'Unsupported engine')
203+
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
204+
t.skip_if(cg.space.index["functional_index"] == nil,
205+
"Functional indexes are not supported by Tarantool")
206+
t.skip_if(helpers.memtx_func_index_is_supported(),
207+
"No errors expected from https://github.com/tarantool/tarantool/issues/6786 " ..
208+
"on this Tarantool version")
209+
205210
local expected = "Functional indices are not supported for Tarantool < 2.8.4," ..
206211
" see options.force_allow_functional_index"
207212

@@ -219,10 +224,13 @@ function g.test_memtx_tree_functional_index_broken(cg)
219224
end
220225

221226
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')
225227
t.skip_if(cg.params.engine == 'vinyl', 'Unsupported engine')
228+
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
229+
t.skip_if(cg.space.index["functional_index"] == nil,
230+
"Functional indexes are not supported by Tarantool")
231+
t.skip_if(helpers.memtx_func_index_is_supported(),
232+
"No errors expected from https://github.com/tarantool/tarantool/issues/6786 " ..
233+
"on this Tarantool version")
226234

227235
helpers.iteration_result = {}
228236

@@ -252,11 +260,16 @@ function g.test_memtx_tree_functional_index_force_broken(cg)
252260
task:kill()
253261
end
254262

263+
-- Vinyl is not supported yet:
264+
-- https://github.com/tarantool/tarantool/issues/4492
255265
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')
259266
t.skip_if(cg.params.engine == 'vinyl', 'Unsupported engine')
267+
t.skip_if(cg.params.index_type ~= 'TREE', 'Unsupported index type')
268+
t.skip_if(cg.space.index["functional_index"] == nil,
269+
"Functional indexes are not supported by Tarantool")
270+
t.skip_if(not helpers.memtx_func_index_is_supported(),
271+
"Blocked by https://github.com/tarantool/tarantool/issues/6786 on " ..
272+
"this Tarantool version")
260273

261274
helpers.iteration_result = {}
262275

test/unit/expirationd_stats_test.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ 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(),
15-
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
14+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
15+
'Blocked by https://github.com/tarantool/tarantool/issues/6448 on ' ..
16+
'this Tarantool version')
1617
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1718
end)
1819

test/unit/iterator_type_test.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ 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(),
15-
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
14+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
15+
'Blocked by https://github.com/tarantool/tarantool/issues/6448 on ' ..
16+
'this Tarantool version')
1617
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1718
end)
1819

test/unit/start_key_test.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ 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(),
14-
'Blocked by https://github.com/tarantool/tarantool/issues/6448')
13+
t.skip_if(cg.params.engine == 'vinyl' and not helpers.vinyl_is_supported(),
14+
'Blocked by https://github.com/tarantool/tarantool/issues/6448 on ' ..
15+
'this Tarantool version')
1516
g.space = helpers.create_space_with_tree_index(cg.params.engine)
1617
end)
1718

0 commit comments

Comments
 (0)