|
1 | 1 | local fio = require('fio')
|
2 | 2 | local crud = require('crud')
|
| 3 | +local crud_utils = require('crud.common.utils') |
3 | 4 | local t = require('luatest')
|
4 | 5 |
|
5 | 6 | local helpers = require('test.helper')
|
@@ -43,6 +44,9 @@ pgroup.before_each(function(g)
|
43 | 44 | helpers.truncate_space_on_cluster(g.cluster, 'customers_name_key_non_uniq_index')
|
44 | 45 | helpers.truncate_space_on_cluster(g.cluster, 'customers_secondary_idx_name_key')
|
45 | 46 | helpers.truncate_space_on_cluster(g.cluster, 'customers_age_key')
|
| 47 | + if crud_utils.tarantool_supports_jsonpath_indexes() then |
| 48 | + helpers.truncate_space_on_cluster(g.cluster, 'customers_jsonpath_key') |
| 49 | + end |
46 | 50 | end)
|
47 | 51 |
|
48 | 52 | local function check_get(g, space_name, id, name)
|
@@ -569,3 +573,81 @@ pgroup.test_update_cache = function(g)
|
569 | 573 | sharding_key_as_index_obj = helpers.update_cache(g.cluster, space_name)
|
570 | 574 | t.assert_equals(sharding_key_as_index_obj, {parts = {{fieldno = 3}}})
|
571 | 575 | end
|
| 576 | + |
| 577 | +pgroup.test_jsonpath_insert = function(g) |
| 578 | + t.skip('JSONpath is unsupported, see issue #219') |
| 579 | + |
| 580 | + local space_name = 'customers_jsonpath_key' |
| 581 | + local customers = helpers.insert_objects(g, space_name, { |
| 582 | + { |
| 583 | + id = {customer_id = {unsigned = 1}}, |
| 584 | + name = 'Viktor Pelevin', |
| 585 | + age = 58, |
| 586 | + data = {customer = {weight = 82}}, |
| 587 | + }, |
| 588 | + { |
| 589 | + id = {customer_id = {unsigned = 2}}, |
| 590 | + name = 'Isaac Asimov', |
| 591 | + age = 72, |
| 592 | + data = {customer = {weight = 70}}, |
| 593 | + }, |
| 594 | + { |
| 595 | + id = {customer_id = {unsigned = 3}}, |
| 596 | + name = 'Aleksandr Solzhenitsyn', |
| 597 | + age = 89, |
| 598 | + data = {customer = {weight = 78}}, |
| 599 | + }, |
| 600 | + { |
| 601 | + id = {customer_id = {unsigned = 4}}, |
| 602 | + name = 'James Joyce', |
| 603 | + age = 59, |
| 604 | + data = {customer = {weight = 82}}, |
| 605 | + }, |
| 606 | + { |
| 607 | + id = {customer_id = {unsigned = 5}}, |
| 608 | + name = 'Oscar Wilde', |
| 609 | + age = 46, |
| 610 | + data = {customer = {weight = 79}}, |
| 611 | + }, |
| 612 | + }) |
| 613 | + t.assert_equals(#customers, 5) |
| 614 | +end |
| 615 | + |
| 616 | +pgroup.test_jsonpath_delete = function(g) |
| 617 | + t.skip('JSONpath is unsupported, see issue #219') |
| 618 | + |
| 619 | + local space_name = 'customers_jsonpath_key' |
| 620 | + local customers = helpers.insert_objects(g, space_name, { |
| 621 | + { |
| 622 | + id = {customer_id = {unsigned = 1}}, |
| 623 | + name = 'Viktor Pelevin', |
| 624 | + age = 58, |
| 625 | + data = {customer = {weight = 82}}, |
| 626 | + }, |
| 627 | + { |
| 628 | + id = {customer_id = {unsigned = 2}}, |
| 629 | + name = 'Isaac Asimov', |
| 630 | + age = 72, |
| 631 | + data = {customer = {weight = 70}}, |
| 632 | + }, |
| 633 | + { |
| 634 | + id = {customer_id = {unsigned = 3}}, |
| 635 | + name = 'Aleksandr Solzhenitsyn', |
| 636 | + age = 89, |
| 637 | + data = {customer = {weight = 78}}, |
| 638 | + }, |
| 639 | + { |
| 640 | + id = {customer_id = {unsigned = 4}}, |
| 641 | + name = 'James Joyce', |
| 642 | + age = 59, |
| 643 | + data = {customer = {weight = 82}}, |
| 644 | + }, |
| 645 | + { |
| 646 | + id = {customer_id = {unsigned = 5}}, |
| 647 | + name = 'Oscar Wilde', |
| 648 | + age = 46, |
| 649 | + data = {customer = {weight = 79}}, |
| 650 | + }, |
| 651 | + }) |
| 652 | + t.assert_equals(#customers, 5) |
| 653 | +end |
0 commit comments