Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: support tests with vshard #381

Merged
merged 2 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 93 additions & 7 deletions .github/workflows/test_on_push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ jobs:
matrix:
# We need 1.10.6 here to check that module works with
# old Tarantool versions that don't have "tuple-keydef"/"tuple-merger" support.
# We test old metrics with Tarantool 2.10 because since Tarantool 2.11.1
# it uses its own metrics package.
# We test old metrics with Cartridge 2.7.9 because since 2.8.0 it
# requires metrics 1.0.0.
tarantool-version: ["1.10.6", "1.10", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "2.8", "2.10", "2.11"]
metrics-version: [""]
cartridge-version: ["2.8.0"]
Expand All @@ -24,16 +28,19 @@ jobs:
- tarantool-version: "2.7"
remove-merger: true
cartridge-version: "2.8.0"
- tarantool-version: "2.11"
metrics-version: "0.1.8"
cartridge-version: "2.8.0"
- tarantool-version: "2.11"
- tarantool-version: "2.10"
metrics-version: "0.10.0"
cartridge-version: "2.8.0"
cartridge-version: "2.7.9"
- tarantool-version: "2.11"
coveralls: true
metrics-version: "1.0.0"
cartridge-version: "2.8.0"
- tarantool-version: "2.11"
metrics-version: "1.0.0"
vshard-version: "0.1.24"
- tarantool-version: "master"
metrics-version: "1.0.0"
vshard-version: "0.1.24"
fail-fast: false
# Can't install older versions on 22.04,
# see https://github.com/tarantool/setup-tarantool/issues/36
Expand All @@ -42,10 +49,42 @@ jobs:
- uses: actions/checkout@master

- name: Setup Tarantool CE
if: matrix.tarantool-version != 'master'
uses: tarantool/setup-tarantool@v2
with:
tarantool-version: ${{ matrix.tarantool-version }}

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | sudo bash
sudo apt install -y tt
tt version

- name: Get Tarantool master latest commit
if: matrix.tarantool-version == 'master'
run: |
commit_hash=$(git ls-remote https://github.com/tarantool/tarantool.git --branch master | head -c 8)
echo "LATEST_COMMIT=${commit_hash}" >> $GITHUB_ENV
shell: bash

- name: Cache Tarantool master
if: matrix.tarantool-version == 'master'
id: cache-latest
uses: actions/cache@v3
with:
path: "${GITHUB_WORKSPACE}/bin"
key: cache-latest-${{ env.LATEST_COMMIT }}

- name: Setup Tarantool master
if: matrix.tarantool-version == 'master' && steps.cache-latest.outputs.cache-hit != 'true'
run: |
tt init
tt install tarantool master

- name: Add Tarantool master to PATH
if: matrix.tarantool-version == 'master'
run: echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH

- name: Fix luarocks in Tarantool CE 1.10.6
if: matrix.tarantool-version == '1.10.6'
run: |
Expand All @@ -57,10 +96,11 @@ jobs:
./deps.sh
env:
CARTRIDGE_VERSION: ${{ matrix.cartridge-version }}
VSHARD_VERSION: ${{ matrix.vshard-version }}

- name: Install metrics
if: matrix.metrics-version != ''
run: tarantoolctl rocks install metrics ${{ matrix.metrics-version }}
run: tt rocks install metrics ${{ matrix.metrics-version }}

- name: Remove external merger if needed
if: ${{ matrix.remove-merger }}
Expand Down Expand Up @@ -90,23 +130,64 @@ jobs:
matrix:
tarantool-version: ["1.10", "2.11"]
metrics-version: ["1.0.0"]
cartridge-version: ["2.8.0"]
include:
- tarantool-version: "master"
metrics-version: "1.0.0"
vshard-version: "0.1.24"
fail-fast: false
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master

- name: Setup Tarantool CE
if: matrix.tarantool-version != 'master'
uses: tarantool/setup-tarantool@v2
with:
tarantool-version: ${{ matrix.tarantool-version }}

- name: Setup tt
run: |
curl -L https://tarantool.io/release/2/installer.sh | sudo bash
sudo apt install -y tt
tt version

- name: Get Tarantool master latest commit
if: matrix.tarantool-version == 'master'
run: |
commit_hash=$(git ls-remote https://github.com/tarantool/tarantool.git --branch master | head -c 8)
echo "LATEST_COMMIT=${commit_hash}" >> $GITHUB_ENV
shell: bash

- name: Cache Tarantool master
if: matrix.tarantool-version == 'master'
id: cache-latest
uses: actions/cache@v3
with:
path: "${GITHUB_WORKSPACE}/bin"
key: cache-latest-${{ env.LATEST_COMMIT }}

- name: Setup Tarantool master
if: matrix.tarantool-version == 'master' && steps.cache-latest.outputs.cache-hit != 'true'
run: |
tt init
tt install tarantool master

- name: Add Tarantool master to PATH
if: matrix.tarantool-version == 'master'
run: echo "${GITHUB_WORKSPACE}/bin" >> $GITHUB_PATH

- name: Install requirements for community
run: |
tarantool --version
./deps.sh
env:
CARTRIDGE_VERSION: ${{ matrix.cartridge-version }}
VSHARD_VERSION: ${{ matrix.vshard-version }}

- name: Install metrics
run: tarantoolctl rocks install metrics ${{ matrix.metrics-version }}
if: matrix.metrics-version != ''
run: tt rocks install metrics ${{ matrix.metrics-version }}

# This server starts and listen on 8084 port that is used for tests
- name: Stop Mono server
Expand All @@ -127,6 +208,7 @@ jobs:
- folder: "2.11"
bundle: "tarantool-enterprise-sdk-nogc64-2.11.0-0-r563.linux.x86_64"
metrics-version: ["", "1.0.0"]
cartridge-version: ["2.8.0"]
fail-fast: false
runs-on: ubuntu-20.04
steps:
Expand All @@ -138,9 +220,13 @@ jobs:
tar -xzf ${{ matrix.tarantool-version.bundle }}.tar.gz
rm -f ${{ matrix.tarantool-version.bundle }}.tar.gz
sudo cp tarantool-enterprise/tarantool /usr/bin/tarantool
sudo rm tarantool-enterprise/tt
source tarantool-enterprise/env.sh
tarantool --version
./deps.sh
env:
CARTRIDGE_VERSION: ${{ matrix.cartridge-version }}
VSHARD_VERSION: ${{ matrix.vshard-version }}

- name: Install metrics
if: matrix.metrics-version != ''
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

### Changed
* `deps.sh` installs the `vshard` instead of the `cartridge` by default (#364).
You could to specify an environment variable `CARTIRDGE_VERSION` to install
the `cartridge` and run tests cases with it.

### Fixed
* `crud.readview` resource cleanup on garbage collect (#379).
* `doc/playground.lua` does not work with Tarantool 3 (#371).
* Tests with Tarantool 3 (#364).

## [1.3.0] - 27-09-23

Expand Down
44 changes: 30 additions & 14 deletions deps.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
#!/bin/sh
#!/usr/bin/env bash
# Call this script to install test dependencies

set -e

TTCTL=tt
if ! [ -x "$(command -v tt)" ];
then
if ! [ -x "$(command -v tarantoolctl)" ];
then
echo "tt or tarantoolctl not found"
exit 1
fi
TTCTL=tarantoolctl
fi

# Test dependencies:
tarantoolctl rocks install luatest
tarantoolctl rocks install luacheck 0.25.0
tarantoolctl rocks install luacov 0.13.0
$TTCTL rocks install luatest
$TTCTL rocks install luacheck 0.25.0
$TTCTL rocks install luacov 0.13.0

# cluacov, luacov-coveralls and dependencies
tarantoolctl rocks install https://raw.githubusercontent.com/mpeterv/cluacov/master/cluacov-scm-1.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/LuaDist/dkjson/master/dkjson-2.5-2.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/keplerproject/luafilesystem/master/luafilesystem-scm-1.rockspec
tarantoolctl rocks install https://raw.githubusercontent.com/moteus/lua-path/master/rockspecs/lua-path-scm-0.rockspec
$TTCTL rocks install https://raw.githubusercontent.com/mpeterv/cluacov/master/cluacov-scm-1.rockspec
$TTCTL rocks install https://raw.githubusercontent.com/LuaDist/dkjson/master/dkjson-2.5-2.rockspec
$TTCTL rocks install https://raw.githubusercontent.com/keplerproject/luafilesystem/master/luafilesystem-scm-1.rockspec
$TTCTL rocks install https://raw.githubusercontent.com/moteus/lua-path/master/rockspecs/lua-path-scm-0.rockspec

# Most of this code is the workaround for
# https://github.com/moteus/luacov-coveralls/pull/30
Expand All @@ -22,14 +33,19 @@ LUACOV_COVERALLS_ROCKSPEC_URL="https://raw.githubusercontent.com/moteus/luacov-c
LUACOV_COVERALLS_ROCKSPEC_FILE="${TMPDIR}/luacov-coveralls-scm-0.rockspec"
curl -fsSL "${LUACOV_COVERALLS_ROCKSPEC_URL}" > "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
sed -i -e 's@git://@git+https://@' "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
tarantoolctl rocks install "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
$TTCTL rocks install "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
rm "${LUACOV_COVERALLS_ROCKSPEC_FILE}"
rmdir "${TMPDIR}"

CARTRIDGE_VERSION="${CARTRIDGE_VERSION:-2.8.0}"
if [[ -n "$CARTRIDGE_VERSION" ]]
then
$TTCTL rocks install cartridge "$CARTRIDGE_VERSION"
$TTCTL rocks install migrations 0.4.2
else
VSHARD_VERSION="${VSHARD_VERSION:-0.1.24}"
$TTCTL rocks install vshard "$VSHARD_VERSION"
fi

tarantoolctl rocks install cartridge "$CARTRIDGE_VERSION"
tarantoolctl rocks install ddl 1.6.2
tarantoolctl rocks install migrations 0.4.2
$TTCTL rocks install ddl 1.6.2

tarantoolctl rocks make
$TTCTL rocks make
9 changes: 8 additions & 1 deletion doc/playground.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ else
fio.rmtree(tempdir)
end

local replicaset_uuid
if box.info().replicaset ~= nil then
replicaset_uuid = box.info().replicaset.uuid
else
replicaset_uuid = box.info().cluster.uuid
end

-- Setup vshard.
_G.vshard = vshard
box.once('guest', function()
Expand All @@ -43,7 +50,7 @@ local uri = 'guest@localhost:3301'
local cfg = {
bucket_count = 3000,
sharding = {
[box.info().cluster.uuid] = {
[replicaset_uuid] = {
replicas = {
[box.info().uuid] = {
uri = uri,
Expand Down
79 changes: 0 additions & 79 deletions test/entrypoint/srv_batch_operations.lua

This file was deleted.

Loading