-
Notifications
You must be signed in to change notification settings - Fork 0
driver: implement tkv driver for tarantool support #10
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '${{ env.GO_VERSION }}' | ||
Comment on lines
+32
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add a newline. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: 'Setup etcd' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add a newline. |
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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need tests with
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, add tests run with |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
bigbes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need a tests that the TCS driver implements the Driver interface. |
||
} |
This file was deleted.
There was a problem hiding this comment.
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.