Skip to content

Commit

Permalink
Fix auth tests for Tarantool >= 2.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
viciious committed Oct 28, 2024
1 parent 9a34fb9 commit 6f8008d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,29 @@ 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
conn, err = box.Connect(&Options{
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
Expand Down
2 changes: 1 addition & 1 deletion const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6f8008d

Please sign in to comment.