From e5ab9f78e3eb93870dea3ddcebd3c97eaf846e79 Mon Sep 17 00:00:00 2001 From: Victor Luchits Date: Mon, 28 Oct 2024 12:50:01 +0300 Subject: [PATCH 1/2] Fix FetchSnapshot in more recent Tarantool versions --- anon_slave_test.go | 4 ++-- const.go | 8 +++++--- fetch_snapshot.go | 5 +++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/anon_slave_test.go b/anon_slave_test.go index 81dcb81..9ef3558 100644 --- a/anon_slave_test.go +++ b/anon_slave_test.go @@ -156,8 +156,8 @@ func TestAnonSlaveSubscribeExpectedReplicaSetUUIDFail(t *testing.T) { ver, err := tntBoxVersion(box) require.NoError(err) - if ver >= version2_8_0 && ver < version2_9_0 { - t.Skip("Tarantool 2.8 returns an empty replicaset UUID, skip check") + if ver >= version2_8_0 && ver < version2_9_0 || ver >= version2_11_0 { + t.Skip("Tarantool 2.8/2.11 returns an empty replicaset UUID, skip check") } s, _ := NewAnonSlave(box.Listen, Options{ diff --git a/const.go b/const.go index 4498c26..c72fd12 100644 --- a/const.go +++ b/const.go @@ -32,6 +32,7 @@ const ( KeyLSN = uint(0x03) KeyTimestamp = uint(0x04) KeySchemaID = uint(0x05) + KeyVersionID = uint(0x06) KeySpaceNo = uint(0x10) KeyIndexNo = uint(0x11) KeyLimit = uint(0x12) @@ -378,7 +379,8 @@ const ( // 2.3.1 is min version for anonymous replication version2_3_1 = uint32(131841) // VersionID(2, 3, 1) // Add box.info.replication_anon - version2_5_1 = uint32(132353) // VersionID(2, 5, 1) - version2_8_0 = uint32(133120) // VersionID(2, 8, 0) - version2_9_0 = uint32(133376) // VersionID(2, 9, 0) + version2_5_1 = uint32(132353) // VersionID(2, 5, 1) + version2_8_0 = uint32(133120) // VersionID(2, 8, 0) + version2_9_0 = uint32(133376) // VersionID(2, 9, 0) + version2_11_0 = uint32(133888) // VersionID(2, 11, 0) ) diff --git a/fetch_snapshot.go b/fetch_snapshot.go index 4ea5fff..d91c3bc 100644 --- a/fetch_snapshot.go +++ b/fetch_snapshot.go @@ -1,5 +1,7 @@ package tarantool +import "github.com/tinylib/msgp/msgp" + // FetchSnapshot is the FETCH_SNAPSHOT command type FetchSnapshot struct{} @@ -12,6 +14,9 @@ func (q *FetchSnapshot) GetCommandID() uint { // MarshalMsg implements msgp.Marshaler func (q *FetchSnapshot) MarshalMsg(b []byte) (o []byte, err error) { o = b + o = msgp.AppendMapHeader(o, 1) + o = msgp.AppendUint(o, KeyVersionID) + o = msgp.AppendUint(o, uint(version2_9_0)) return o, nil } From 5979836dfd96d51f90ab1af4b50a7f5f6f6beb6f Mon Sep 17 00:00:00 2001 From: Victor Luchits Date: Mon, 28 Oct 2024 13:34:55 +0300 Subject: [PATCH 2/2] Fix auth tests for Tarantool >= 2.11.0 --- auth_test.go | 16 ++++++++++++++-- const.go | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/auth_test.go b/auth_test.go index 3851c0c..a51b5cd 100644 --- a/auth_test.go +++ b/auth_test.go @@ -25,8 +25,14 @@ func TestAuth(t *testing.T) { User: "user_not_found", Password: "qwerty", }) + ver, _ := tntBoxVersion(box) + if assert.Error(err) && assert.Nil(conn) { - assert.Contains(err.Error(), "is not found") + if ver >= version2_11_0 { + assert.Exactly(err.Error(), "User not found or supplied credentials are invalid") + } else { + assert.Contains(err.Error(), "is not found") + } } // bad password @@ -34,8 +40,14 @@ func TestAuth(t *testing.T) { User: "tester", Password: "qwerty", }) + ver, _ = tntBoxVersion(box) + if assert.Error(err) && assert.Nil(conn) { - assert.Contains(err.Error(), "Incorrect password supplied for user") + if ver >= version2_11_0 { + assert.Exactly(err.Error(), "User not found or supplied credentials are invalid") + } else { + assert.Contains(err.Error(), "Incorrect password supplied for user") + } } // ok user password diff --git a/const.go b/const.go index c72fd12..3ef7858 100644 --- a/const.go +++ b/const.go @@ -136,7 +136,7 @@ const ( ErrDropUser = uint(0x2c) // Failed to drop user '%s': %s ErrNoSuchUser = uint(0x2d) // User '%s' is not found ErrUserExists = uint(0x2e) // User '%s' already exists - ErrPasswordMismatch = uint(0x2f) // Incorrect password supplied for user '%s' + ErrCredsMismatch = uint(0x2f) // User not found or supplied credentials are invalid ErrUnknownRequestType = uint(0x30) // Unknown request type %u ErrUnknownSchemaObject = uint(0x31) // Unknown object type '%s' ErrCreateFunction = uint(0x32) // Failed to create function '%s': %s