Skip to content

Commit f8063da

Browse files
committed
Tests
1 parent b854f4b commit f8063da

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

crud/common/utils.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ local function determine_enabled_features()
251251

252252
-- since Tarantool 2.4
253253
enabled_tarantool_features.uuids = major >= 2 and (minor > 4 or minor == 4 and patch >= 1)
254+
255+
-- since Tarantool 2.6.3 / 2.7.2 / 2.8.1
256+
enabled_tarantool_features.jsonpath_indexes = major >= 3 or (major >= 2 and ((minor >= 6 and patch >= 3)
257+
or (minor >= 7 and patch >= 2) or (minor >= 8 and patch >= 1) or minor >= 9))
254258
end
255259

256260
function utils.tarantool_supports_fieldpaths()
@@ -269,6 +273,14 @@ function utils.tarantool_supports_uuids()
269273
return enabled_tarantool_features.uuids
270274
end
271275

276+
function utils.tarantool_supports_jsonpath_indexes()
277+
if enabled_tarantool_features.jsonpath_indexes == nil then
278+
determine_enabled_features()
279+
end
280+
281+
return enabled_tarantool_features.jsonpath_indexes
282+
end
283+
272284
local function add_nullable_fields_recursive(operations, operations_map, space_format, tuple, id)
273285
if id < 2 or tuple[id - 1] ~= box.NULL then
274286
return operations

test/entrypoint/srv_select.lua

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,43 @@ package.preload['customers-storage'] = function()
151151
unique = false,
152152
if_not_exists = true,
153153
})
154+
155+
if crud_utils.tarantool_supports_jsonpath_indexes() then
156+
local cars_space = box.schema.space.create('cars', {
157+
format = {
158+
{name = 'id', type = 'map'},
159+
{name = 'bucket_id', type = 'unsigned'},
160+
{name = 'age', type = 'number'},
161+
{name = 'manufacturer', type = 'string'},
162+
{name = 'data', type = 'map'}
163+
},
164+
if_not_exists = true,
165+
engine = engine,
166+
})
167+
168+
-- primary index
169+
cars_space:create_index('id_ind', {
170+
parts = {
171+
{1, 'unsigned', path = 'car_id.signed'},
172+
},
173+
if_not_exists = true,
174+
})
175+
176+
cars_space:create_index('bucket_id', {
177+
parts = { 'bucket_id' },
178+
unique = false,
179+
if_not_exists = true,
180+
})
181+
182+
cars_space:create_index('data_index', {
183+
parts = {
184+
{5, 'str', path = 'car.color'},
185+
{5, 'str', path = 'car.model'},
186+
},
187+
unique = false,
188+
if_not_exists = true,
189+
})
190+
end
154191
end,
155192
}
156193
end

test/integration/select_test.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,11 @@ pgroup:set_after_all(function(g) helpers.stop_cluster(g.cluster) end)
3131

3232
pgroup:set_before_each(function(g)
3333
helpers.truncate_space_on_cluster(g.cluster, 'customers')
34+
<<<<<<< HEAD
3435
helpers.truncate_space_on_cluster(g.cluster, 'developers')
36+
=======
37+
helpers.truncate_space_on_cluster(g.cluster, 'cars')
38+
>>>>>>> 7b67809 (Tests)
3539
end)
3640

3741

0 commit comments

Comments
 (0)