Skip to content

Commit

Permalink
ddl: update TestDefaultColumnWithReplace error code (#51115)
Browse files Browse the repository at this point in the history
close #51114
  • Loading branch information
zimulala authored Feb 18, 2024
1 parent aca145b commit a465300
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/ddl/db_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,16 @@ func TestDefaultColumnWithReplace(t *testing.T) {

// insert records
tk.MustExec("insert into t(c) values (1),(2),(3)")
// Different UUID values will result in different error code.
tk.MustGetErrCode("insert into t1(c) values (1)", errno.ErrTruncatedWrongValue)
_, err := tk.Exec("insert into t1(c) values (1)")
originErr := errors.Cause(err)
tErr, ok := originErr.(*terror.Error)
require.Truef(t, ok, "expect type 'terror.Error', but obtain '%T': %v", originErr, originErr)
sqlErr := terror.ToSQLError(tErr)
if int(sqlErr.Code) != errno.ErrTruncatedWrongValue {
require.Equal(t, errno.ErrDataOutOfRange, int(sqlErr.Code))
}

rows := tk.MustQuery("SELECT c1 from t").Rows()
for _, row := range rows {
Expand Down

0 comments on commit a465300

Please sign in to comment.