Skip to content

Commit

Permalink
Fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiee committed Oct 11, 2022
1 parent 07eab81 commit ad80233
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
11 changes: 2 additions & 9 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,12 @@ func TestConnection(t *testing.T) {
}
checkConResp("return 1", resp)

resp, err = conn.execute(sessionID, "return 1")
resp, err = conn.execute(sessionID, "DROP SPACE client_test;")
if err != nil {
t.Error(err.Error())
return
}
checkConResp("return 1", resp)

// resp, err = conn.execute(sessionID, "DROP SPACE client_test;")
// if err != nil {
// t.Error(err.Error())
// return
// }
// checkConResp( "drop space", resp)
checkConResp("drop space", resp)

res := conn.ping()
if res != true {
Expand Down
8 changes: 8 additions & 0 deletions session_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,14 @@ func (pool *SessionPool) newSession() (*Session, error) {
if err != nil {
return nil, fmt.Errorf("failed to create a new session: %s", err.Error())
}

// If the authentication failed, close the session pool because the pool must have a valid user to work
if authResp.GetErrorCode() != 0 {
pool.Close()
return nil, fmt.Errorf("failed to authenticate the user, error code: %d, error message: %s, the pool has been closed",
authResp.ErrorCode, authResp.ErrorMsg)
}

sessID := authResp.GetSessionID()
timezoneOffset := authResp.GetTimeZoneOffsetSeconds()
timezoneName := authResp.GetTimeZoneName()
Expand Down

0 comments on commit ad80233

Please sign in to comment.