Skip to content
Open
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
72 changes: 72 additions & 0 deletions .github/actions/prepare-ee-test-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "Prepare test environment with Tarantool EE"
description: "Prepares test environment with Tarantool EE"

inputs:
sdk-version:
required: true
type: string
sdk-build:
required: false
type: string
default: release
sdk-gc:
required: false
type: string
default: gc64
sdk-download-token:
required: true
type: string
skip-etcd-install:
description: Whether to skip etcd installation
type: boolean
required: false
default: false

env:
# Note: Use exactly match version of tool, to avoid unexpected issues with test on CI.
GO_VERSION: '1.23.8'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the library requires 1.24 in the go.mod.


runs:
using: "composite"
steps:
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '${{ env.GO_VERSION }}'
Comment on lines +32 to +35
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably we don't need the Go here. It is better to install the Go in a job pipeline directly.


- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '${{ env.PYTHON_VERSION }}'

- name: Setup Mage
run: |
git clone https://github.com/magefile/mage
cd mage
go run bootstrap.go
shell: bash

- name: Install build requirements
run: |
sudo apt -y update
sudo apt -y install git gcc make cmake unzip zip fish zsh
shell: bash
Comment on lines +37 to +53
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need the stuff here.


- name: Cache Tarantool SDK
id: cache-sdk
uses: actions/cache@v3
with:
path: tarantool-enterprise
key: ${{ matrix.sdk-version }}

- name: Download Tarantool SDK
run: |
ARCHIVE_NAME=tarantool-enterprise-sdk-${{ inputs.sdk-gc }}-${{ inputs.sdk-version }}.tar.gz
ARCHIVE_PATH=$(echo ${{ inputs.sdk-version }} | sed -rn \
's/^([0-9]+)\.([0-9]+)\.([0-9]+-){2}([a-z0-9]+-)?r[0-9]+\.([a-z]+)\.([a-z0-9_]+)$/${{ inputs.sdk-build }}\/\5\/\6\/\1\.\2/p')
curl -O -L -v \
https://tarantool:${{ inputs.sdk-download-token }}@download.tarantool.io/enterprise/${ARCHIVE_PATH}/${ARCHIVE_NAME}
tar -xzf ${ARCHIVE_NAME}
rm -f ${ARCHIVE_NAME}
source tarantool-enterprise/env.sh
shell: bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add a newline.

47 changes: 47 additions & 0 deletions .github/actions/setup-etcd/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Setup etcd'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it for a future using? Please, add it into separate commit if so.

description: 'Download and extract etcd release archive'
inputs:
etcd-version:
description: 'Release name from https://github.com/etcd-io/etcd/releases'
required: false
default: v3.5.9
install-prefix:
description: 'Where to extract the archive'
default: ${{ github.workspace }}/.etcd/bin/
runs:
using: 'composite'
steps:
- shell: bash
env:
BASE_URL: "https://github.com/etcd-io/etcd/releases/download"
ETCD_VER: ${{ inputs.etcd-version }}
INSTALL_PREFIX: ${{ inputs.install-prefix }}
run: |
set -eux
rm -rf ${INSTALL_PREFIX} && mkdir -p ${INSTALL_PREFIX}
OS_NAME="$(uname | tr '[:upper:]' '[:lower:]')"
ARCH=$(uname -m | awk '{print ($0 == "x86_64")?"amd64":"arm64"}')
FILENAME="etcd-${ETCD_VER}-${OS_NAME}-${ARCH}"
if [ "${OS_NAME}" == "linux" ]; then
curl -L "${BASE_URL}/${ETCD_VER}/${FILENAME}.tar.gz" -o "${INSTALL_PREFIX}/${FILENAME}.tar.gz"
tar xvzf "${INSTALL_PREFIX}/${FILENAME}.tar.gz" -C ${INSTALL_PREFIX} --strip-components=1
elif [[ "${OS_NAME}" == "darwin" ]]; then
curl -L "${BASE_URL}/${ETCD_VER}/${FILENAME}.zip" -o "${INSTALL_PREFIX}/${FILENAME}.zip"
unzip "${INSTALL_PREFIX}/${FILENAME}.zip" -d ${INSTALL_PREFIX}
ln -s ${INSTALL_PREFIX}/${FILENAME}/etcd ${INSTALL_PREFIX}/etcd
ln -s ${INSTALL_PREFIX}/${FILENAME}/etcdctl ${INSTALL_PREFIX}/etcdctl
else
echo "Unsupported OS: ${OS_NAME}"
exit 1
fi
- shell: bash
env:
INSTALL_PREFIX: ${{ inputs.install-prefix }}
run: |
set -eux
${INSTALL_PREFIX}/etcd --version
${INSTALL_PREFIX}/etcdctl version 2>/dev/null || ${INSTALL_PREFIX}/etcdctl --version
echo "ETCD_PATH=$(echo $INSTALL_PREFIX)" >> "$GITHUB_ENV"
echo "${INSTALL_PREFIX}" >> "$GITHUB_PATH"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add a newline.

54 changes: 54 additions & 0 deletions .github/workflows/tkv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: tkv.yaml
on:
pull_request_target:
types: [ labeled ]

env:
# Note: Use exactly match version of tool, to avoid unexpected issues with test on CI.
GO_VERSION: '1.24.9'


jobs:
full-ci-ee:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need tests with ce too for a some common purposes. The idea here:

  1. A user makes pull requests.
  2. We run all tests exclude integration tests with tcs as a first check.
  3. A user with write access sets the full-ci label.
  4. We run addition tests on Tarantool EE to ensure that everything work fine.

The pattern is used across our libraries. So, please, implement it here too.

# Tests will run only when the pull request is labeled with `full-ci`. To
# avoid security problems, the label must be reset manually for every run.
#
# We need to use `pull_request_target` because it has access to base
# repository secrets unlike `pull_request`.
if: (github.event_name == 'push') ||
(github.event_name == 'pull_request_target' &&
github.event.action == 'labeled' &&
github.event.label.name == 'full-ci') ||
(github.event_name == 'pull_request' &&
github.event.action == 'synchronize' &&
github.event.pull_request.head.repo.full_name == github.repository &&
contains(github.event.pull_request.labels.*.name, 'full-ci'))
runs-on: ubuntu-22.04
strategy:
matrix:
sdk-version:
- "3.5.0-0-r70.linux.x86_64"
fail-fast: false
steps:
# `ref` as merge request is needed for pull_request_target because this
# target runs in the context of the base commit of the pull request.
- uses: actions/checkout@v4
if: github.event_name == 'pull_request_target'
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- uses: actions/checkout@v4
if: github.event_name != 'pull_request_target'
with:
fetch-depth: 0

- name: Prepare EE env
uses: ./.github/actions/prepare-ee-test-env
with:
sdk-version: '${{ matrix.sdk-version }}'
sdk-download-token: '${{ secrets.SDK_DOWNLOAD_TOKEN }}'

- name: Integration tests
run:
go test ./... -count=1 -v
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add tests run with race detection too.

2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,12 @@ linters:
- "go.etcd.io/etcd/client/v3"
- "github.com/tarantool/go-tarantool/v2"
- "github.com/tarantool/go-option"
- "github.com/vmihailenco/msgpack/v5"
test:
files:
- "$test"
allow:
- $gostd
- "github.com/tarantool/go-storage"
- "github.com/stretchr/testify"
- "github.com/tarantool/go-tarantool/v2"
4 changes: 3 additions & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,7 @@ type Driver interface {

// Watch establishes a watch stream for changes to a specific key or prefix.
// The returned channel will receive events as changes occur.
Watch(ctx context.Context, key []byte, opts ...watch.Option) <-chan watch.Event
// The returned cleanup function should be called to stop the watch and release resources.
// An error is returned if the watch could not be established.
Watch(ctx context.Context, key []byte, opts ...watch.Option) (<-chan watch.Event, func(), error)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a tests that the TCS driver implements the Driver interface.

}
2 changes: 1 addition & 1 deletion driver/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ func (d Driver) Execute(

// Watch monitors changes to a specific key and returns a stream of events.
// It supports optional watch configuration through the opts parameter.
func (d Driver) Watch(_ context.Context, _ []byte, _ ...watch.Option) <-chan watch.Event {
func (d Driver) Watch(_ context.Context, _ []byte, _ ...watch.Option) (<-chan watch.Event, func(), error) {
panic("implement me")
}
84 changes: 0 additions & 84 deletions driver/tcs/tcs.go

This file was deleted.

Loading
Loading