Skip to content

tests: add helpers for TcS #431

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

Merged
merged 3 commits into from
Mar 10, 2025
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/reusable_testing.yml
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@ on:

jobs:
run_tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Clone the go-tarantool connector
uses: actions/checkout@v4
15 changes: 11 additions & 4 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ jobs:

# We could replace it with ubuntu-latest after fixing the bug:
# https://github.com/tarantool/setup-tarantool/issues/37
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
fail-fast: false
@@ -100,9 +100,10 @@ jobs:
run: make deps

- name: Run regression tests
run: |
make test
make testrace
run: make test

- name: Run race tests
run: make testrace

- name: Run fuzzing tests
if: ${{ matrix.fuzzing }}
@@ -116,6 +117,7 @@ jobs:
make coveralls

- name: Check workability of benchmark tests
if: matrix.golang == 'stable'
run: make bench-deps bench DURATION=1x COUNT=1

testing_mac_os:
@@ -270,6 +272,10 @@ jobs:
run: |
cd "${SRCDIR}"
make test

- name: Run race tests
run: |
cd "${SRCDIR}"
make testrace

- name: Run fuzzing tests
@@ -279,6 +285,7 @@ jobs:
make fuzzing TAGS="go_tarantool_decimal_fuzzing"

- name: Check workability of benchmark tests
if: matrix.golang == 'stable'
run: |
cd "${SRCDIR}"
make bench-deps bench DURATION=1x COUNT=1
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -12,11 +12,23 @@ Versioning](http://semver.org/spec/v2.0.0.html) except to the first release.

- Extend box with replication information (#427).
- The Instance info has been added to ConnectionInfo for GetInfo response (#429).
- Added helpers to run Tarantool config storage (#431).

### Changed

- Changed helpers API `StartTarantool` and `StopTarantool`, now it uses
pointer on `TarantoolInstance`:
* `StartTarantool()` returns `*TarantoolInstance`;
* `StopTarantool()` and `StopTarantoolWithCleanup()` accepts
`*TarantoolInstance` as arguments.
- Field `Cmd` in `TarantoolInstance` struct declared as deprecated.
Suggested `Wait()`, `Stop()` and `Signal()` methods as safer to use
instead of direct `Cmd.Process` access (#431).

### Fixed

- Fixed flaky test detection on fail start Tarantool instance (#431).

## [v2.2.1] - 2024-12-17

The release fixes a schema lost after a reconnect.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -108,7 +108,7 @@ test-main:
coverage:
go clean -testcache
go get golang.org/x/tools/cmd/cover
go test -tags "$(TAGS)" ./... -v -p 1 -covermode=atomic -coverprofile=$(COVERAGE_FILE)
go test -tags "$(TAGS)" $(go list ./... | grep -v test_helpers) -v -p 1 -covermode=atomic -coverprofile=$(COVERAGE_FILE)
go tool cover -func=$(COVERAGE_FILE)

.PHONY: coveralls
14 changes: 7 additions & 7 deletions pool/connection_pool_test.go
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ var connOpts = tarantool.Opts{
var defaultCountRetry = 5
var defaultTimeoutRetry = 500 * time.Millisecond

var helpInstances []test_helpers.TarantoolInstance
var helpInstances []*test_helpers.TarantoolInstance

func TestConnect_error_duplicate(t *testing.T) {
ctx, cancel := test_helpers.GetPoolConnectContext()
@@ -404,7 +404,7 @@ func TestReconnect(t *testing.T) {
defaultCountRetry, defaultTimeoutRetry)
require.Nil(t, err)

err = test_helpers.RestartTarantool(&helpInstances[0])
err = test_helpers.RestartTarantool(helpInstances[0])
require.Nilf(t, err, "failed to restart tarantool")

args = test_helpers.CheckStatusesArgs{
@@ -453,7 +453,7 @@ func TestDisconnect_withReconnect(t *testing.T) {
require.Nil(t, err)

// Restart the server after success.
err = test_helpers.RestartTarantool(&helpInstances[serverId])
err = test_helpers.RestartTarantool(helpInstances[serverId])
require.Nilf(t, err, "failed to restart tarantool")

args = test_helpers.CheckStatusesArgs{
@@ -501,10 +501,10 @@ func TestDisconnectAll(t *testing.T) {
defaultCountRetry, defaultTimeoutRetry)
require.Nil(t, err)

err = test_helpers.RestartTarantool(&helpInstances[0])
err = test_helpers.RestartTarantool(helpInstances[0])
require.Nilf(t, err, "failed to restart tarantool")

err = test_helpers.RestartTarantool(&helpInstances[1])
err = test_helpers.RestartTarantool(helpInstances[1])
require.Nilf(t, err, "failed to restart tarantool")

args = test_helpers.CheckStatusesArgs{
@@ -1362,10 +1362,10 @@ func TestRequestOnClosed(t *testing.T) {
_, err = connPool.Ping(pool.ANY)
require.NotNilf(t, err, "err is nil after Ping")

err = test_helpers.RestartTarantool(&helpInstances[0])
err = test_helpers.RestartTarantool(helpInstances[0])
require.Nilf(t, err, "failed to restart tarantool")

err = test_helpers.RestartTarantool(&helpInstances[1])
err = test_helpers.RestartTarantool(helpInstances[1])
require.Nilf(t, err, "failed to restart tarantool")
}

4 changes: 1 addition & 3 deletions queue/queue_test.go
Original file line number Diff line number Diff line change
@@ -23,8 +23,6 @@ const (
var servers = []string{"127.0.0.1:3014", "127.0.0.1:3015"}
var server = "127.0.0.1:3013"

var instances []test_helpers.TarantoolInstance

var dialer = NetDialer{
Address: server,
User: user,
@@ -931,7 +929,7 @@ func runTestMain(m *testing.M) int {
})
}

instances, err = test_helpers.StartTarantoolInstances(poolInstsOpts)
instances, err := test_helpers.StartTarantoolInstances(poolInstsOpts)

if err != nil {
log.Printf("Failed to prepare test tarantool pool: %s", err)
Loading