-
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,51 @@ | ||
| 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 | ||
|
|
||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - 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 \ | ||
| https://${{ inputs.sdk-download-token }}@download.tarantool.io/enterprise/${ARCHIVE_PATH}/${ARCHIVE_NAME} | ||
| if [ $(stat -c%s "${ARCHIVE_NAME}") -eq 0 ]; then | ||
| echo "Failed to download Tarantool EE SDK: '${ARCHIVE_PATH}/${ARCHIVE_NAME}'" | ||
| exit 1 | ||
| fi | ||
| tar -xzf ${ARCHIVE_NAME} | ||
| rm -f ${ARCHIVE_NAME} | ||
| source tarantool-enterprise/env.sh | ||
| shell: bash | ||
|
|
||
| - name: Add SDK to PATH and set TARANTOOL_SDK_PATH variable | ||
| run: | | ||
| SDK_PATH="$(realpath tarantool-enterprise)" | ||
| echo "${SDK_PATH}" >> ${GITHUB_PATH} | ||
| echo "TARANTOOL_SDK_PATH=${SDK_PATH}" >> ${GITHUB_ENV} | ||
| shell: bash |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| name: tcs.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: | ||
| # 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 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. Done |
||
|
|
||
| - name: Integration tests | ||
| run: | ||
| go test ./... -count=100 -v -race | ||
| 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. 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. This is used, instead: Line 33 in 5285223
|
||||
| } | ||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| package tcs | ||
|
|
||
| import ( | ||
| "fmt" | ||
| ) | ||
|
|
||
| // DecodingError represents an error that occurs during decoding operations. | ||
| type DecodingError struct { | ||
| ObjectType string | ||
| Text string | ||
| Err error | ||
| } | ||
|
|
||
| // Error returns the error message. | ||
| func (e DecodingError) Error() string { | ||
| suffix := e.ObjectType | ||
| if e.Text != "" { | ||
| suffix = fmt.Sprintf("%s, %s", suffix, e.Text) | ||
| } | ||
|
|
||
| return fmt.Sprintf("failed to decode %s: %s", suffix, e.Err) | ||
| } | ||
|
|
||
| func (e DecodingError) Unwrap() error { | ||
| return e.Err | ||
| } | ||
|
|
||
| // NewTxnOpResponseDecodingError returns a new txnOpResponse decoding error. | ||
| func NewTxnOpResponseDecodingError(err error) error { | ||
| if err == nil { | ||
| return nil | ||
| } | ||
|
|
||
| return DecodingError{ | ||
| ObjectType: "txnOpResponse", | ||
| Text: "", | ||
| Err: err, | ||
| } | ||
| } | ||
|
|
||
| // EncodingError represents an error that occurs during encoding operations. | ||
| type EncodingError struct { | ||
| ObjectType string | ||
| Text string | ||
| Err error | ||
| } | ||
|
|
||
| // Error returns the error message. | ||
| func (e EncodingError) Error() string { | ||
| if e.Text == "" { | ||
| return fmt.Sprintf("failed to encode %s: %s", e.ObjectType, e.Err) | ||
| } | ||
|
|
||
| return fmt.Sprintf("failed to encode %s, %s: %s", e.ObjectType, e.Text, e.Err) | ||
| } | ||
|
|
||
| func (e EncodingError) Unwrap() error { | ||
| return e.Err | ||
| } | ||
|
|
||
| // NewOperationEncodingError returns a new operation encoding error. | ||
| func NewOperationEncodingError(text string, err error) error { | ||
| if err == nil { | ||
| return nil | ||
| } | ||
|
|
||
| return EncodingError{ | ||
| ObjectType: "operation", | ||
| Text: text, | ||
| Err: err, | ||
| } | ||
| } | ||
|
|
||
| // NewPredicateEncodingError returns a new predicate encoding error. | ||
| func NewPredicateEncodingError(text string, err error) error { | ||
| if err == nil { | ||
| return nil | ||
| } | ||
|
|
||
| return EncodingError{ | ||
| ObjectType: "predicate", | ||
| Text: text, | ||
| Err: err, | ||
| } | ||
| } |
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.
We need tests with
cetoo for a some common purposes. The idea here:writeaccess sets thefull-cilabel.The pattern is used across our libraries. So, please, implement it here too.
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.
This is already implemented.