Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mRrvz committed May 27, 2021
1 parent b854f4b commit f8063da
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crud/common/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ local function determine_enabled_features()

-- since Tarantool 2.4
enabled_tarantool_features.uuids = major >= 2 and (minor > 4 or minor == 4 and patch >= 1)

-- since Tarantool 2.6.3 / 2.7.2 / 2.8.1
enabled_tarantool_features.jsonpath_indexes = major >= 3 or (major >= 2 and ((minor >= 6 and patch >= 3)
or (minor >= 7 and patch >= 2) or (minor >= 8 and patch >= 1) or minor >= 9))
end

function utils.tarantool_supports_fieldpaths()
Expand All @@ -269,6 +273,14 @@ function utils.tarantool_supports_uuids()
return enabled_tarantool_features.uuids
end

function utils.tarantool_supports_jsonpath_indexes()
if enabled_tarantool_features.jsonpath_indexes == nil then
determine_enabled_features()
end

return enabled_tarantool_features.jsonpath_indexes
end

local function add_nullable_fields_recursive(operations, operations_map, space_format, tuple, id)
if id < 2 or tuple[id - 1] ~= box.NULL then
return operations
Expand Down
37 changes: 37 additions & 0 deletions test/entrypoint/srv_select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,43 @@ package.preload['customers-storage'] = function()
unique = false,
if_not_exists = true,
})

if crud_utils.tarantool_supports_jsonpath_indexes() then
local cars_space = box.schema.space.create('cars', {
format = {
{name = 'id', type = 'map'},
{name = 'bucket_id', type = 'unsigned'},
{name = 'age', type = 'number'},
{name = 'manufacturer', type = 'string'},
{name = 'data', type = 'map'}
},
if_not_exists = true,
engine = engine,
})

-- primary index
cars_space:create_index('id_ind', {
parts = {
{1, 'unsigned', path = 'car_id.signed'},
},
if_not_exists = true,
})

cars_space:create_index('bucket_id', {
parts = { 'bucket_id' },
unique = false,
if_not_exists = true,
})

cars_space:create_index('data_index', {
parts = {
{5, 'str', path = 'car.color'},
{5, 'str', path = 'car.model'},
},
unique = false,
if_not_exists = true,
})
end
end,
}
end
Expand Down
4 changes: 4 additions & 0 deletions test/integration/select_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ pgroup:set_after_all(function(g) helpers.stop_cluster(g.cluster) end)

pgroup:set_before_each(function(g)
helpers.truncate_space_on_cluster(g.cluster, 'customers')
<<<<<<< HEAD
helpers.truncate_space_on_cluster(g.cluster, 'developers')
=======
helpers.truncate_space_on_cluster(g.cluster, 'cars')
>>>>>>> 7b67809 (Tests)
end)


Expand Down

0 comments on commit f8063da

Please sign in to comment.