Skip to content

Commit

Permalink
Add Tarantool 2.11 and 3.0 to tests workflow
Browse files Browse the repository at this point in the history
We've switched to using the `tt` utility instead of `tarantoolctl` when
testing on versions 3.0 [1].

We've also fixed the tests for `box.tuple`, so the interface of `new()`
function has changed [2].

[1]: tarantool/tarantool#9443
[2]: https://github.com/tarantool/tarantool/releases/tag/3.0.0
  • Loading branch information
ochaplashkin committed May 15, 2024
1 parent 585edf1 commit d554c72
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 25 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,20 @@ jobs:
github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != 'tarantool'
strategy:
matrix:
tarantool: ["1.10", "2.6", "2.7", "2.8", "2.10"]
tarantool: ["1.10", "2.6", "2.7", "2.8", "2.10", "2.11", "3.0"]
fail-fast: false
runs-on: [ubuntu-20.04]
steps:
- uses: actions/checkout@master
- uses: tarantool/setup-tarantool@v1
- uses: tarantool/setup-tarantool@v3
with:
tarantool-version: '${{ matrix.tarantool }}'

- name: Install tt utility
run: |
curl -L https://tarantool.io/GcTQaQl/release/2/installer.sh | bash
sudo apt-get -y install tt
- name: Install requirements for community
run: |
cmake -S . -B build
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES .rocks)
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/.rocks
DEPENDS ${PROJECT_NAME}-scm-1.rockspec
COMMAND tarantoolctl rocks make ./${PROJECT_NAME}-scm-1.rockspec
COMMAND tarantoolctl rocks install http 1.1.0
COMMAND tarantoolctl rocks install luacheck 0.25.0
COMMAND tarantoolctl rocks install luacov 0.13.0
COMMAND tt rocks make ./${PROJECT_NAME}-scm-1.rockspec
COMMAND tt rocks install http 1.1.0
COMMAND tt rocks install luacheck 0.25.0
COMMAND tt rocks install luacov 0.13.0
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)

Expand All @@ -51,7 +51,7 @@ add_custom_target(bootstrap DEPENDS ${PROJECT_SOURCE_DIR}/.rocks)
add_custom_command(
OUTPUT ${PROJECT_SOURCE_DIR}/.rocks/bin/ldoc
DEPENDS bootstrap
COMMAND tarantoolctl rocks install ldoc --server=http://rocks.moonscript.org
COMMAND tt rocks install ldoc --server=http://rocks.moonscript.org
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)

Expand Down
36 changes: 18 additions & 18 deletions test/luatest_test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,26 @@ g.test_assert_is_box_null = function()
end

g.test_assert_equals_tnt_tuples = function()
t.assert_equals(box.tuple.new(1), box.tuple.new(1))
t.assert_equals(box.tuple.new(1, 'a', box.NULL), box.tuple.new(1, 'a', box.NULL))
t.assert_equals(box.tuple.new(1, {'a'}), box.tuple.new(1, {'a'}))
t.assert_equals({box.tuple.new(1)}, {box.tuple.new(1)})
t.assert_equals({box.tuple.new(1)}, {{1}})
helper.assert_failure(t.assert_equals, box.tuple.new(1), box.tuple.new(2))

t.assert_not_equals(box.tuple.new(1), box.tuple.new(2))
t.assert_not_equals(box.tuple.new(1, 'a', box.NULL, {}), box.tuple.new(1, 'a'))
t.assert_not_equals(box.tuple.new(1, {'a'}), box.tuple.new(1, {'b'}))
helper.assert_failure(t.assert_not_equals, box.tuple.new(1), box.tuple.new(1))
t.assert_equals(box.tuple.new({1}), box.tuple.new({1}))
t.assert_equals(box.tuple.new({1, 'a', box.NULL}), box.tuple.new({1, 'a', box.NULL}))
t.assert_equals(box.tuple.new({1, {'a'}}), box.tuple.new({1, {'a'}}))
t.assert_equals({box.tuple.new({1})}, {box.tuple.new({1})})
t.assert_equals({box.tuple.new({1})}, {{1}})
helper.assert_failure(t.assert_equals, box.tuple.new({1}), box.tuple.new({2}))

t.assert_not_equals(box.tuple.new({1}), box.tuple.new({2}))
t.assert_not_equals(box.tuple.new({1, 'a', box.NULL, {}}), box.tuple.new({1, 'a'}))
t.assert_not_equals(box.tuple.new({1, {'a'}}), box.tuple.new({1, {'b'}}))
helper.assert_failure(t.assert_not_equals, box.tuple.new({1}), box.tuple.new({1}))

-- Check that other cdata values works fine.
t.assert_equals(1ULL, 0ULL + 1)
end

g.test_assert_items_equals_tnt_tuples = function()
t.assert_items_equals({box.tuple.new(1)}, {box.tuple.new(1)})
g.test_assert_items_equals_tnt_tuples_v3 = function()
t.assert_items_equals({box.tuple.new({1})}, {box.tuple.new({1})})
helper.assert_failure_contains('Item values of the tables are not identical',
t.assert_items_equals, {box.tuple.new(1)}, {box.tuple.new(2)})
t.assert_items_equals, {box.tuple.new({1})}, {box.tuple.new({2})})
end

g.test_fail_if_tnt_specific = function()
Expand Down Expand Up @@ -115,14 +115,14 @@ g.test_assert_covers = function()
subject({a = 1, b = 2, c = 3}, {a = 1, c = 3})
subject({a = 1, b = 2, c = 3}, {a = 1, b = 2, c = 3})
subject({a = box.NULL}, {a = box.NULL})
subject({a = box.tuple.new(1)}, {a = box.tuple.new(1)})
subject({a = box.tuple.new({1})}, {a = box.tuple.new({1})})

helper.assert_failure(subject, {a = 1, b = 2, c = 3}, {a = 2})
helper.assert_failure(subject, {a = 1, b = 2, c = 3}, {a = 1, b = 1})
helper.assert_failure(subject, {a = 1, b = 2, c = 3}, {a = 1, b = 2, c = 3, d = 4})
helper.assert_failure(subject, {a = 1, b = 2, c = 3}, {d = 1})
helper.assert_failure(subject, {a = nil}, {a = box.NULL})
helper.assert_failure(subject, {a = box.tuple.new(1)}, {a = box.tuple.new(2)})
helper.assert_failure(subject, {a = box.tuple.new({1})}, {a = box.tuple.new({2})})
helper.assert_failure_contains('Argument 1 and 2 must be tables', subject, {a = 1, b = 2, c = 3}, nil)
end

Expand All @@ -144,9 +144,9 @@ end

g.test_assert_items_include = function()
local subject = t.assert_items_include
subject({1, box.tuple.new(1)}, {box.tuple.new(1)})
subject({1, box.tuple.new({1})}, {box.tuple.new({1})})

helper.assert_failure(subject, {box.tuple.new(1)}, {box.tuple.new(2)})
helper.assert_failure(subject, {box.tuple.new({1})}, {box.tuple.new({2})})
end

g.test_assert_type = function()
Expand Down

0 comments on commit d554c72

Please sign in to comment.