Skip to content

Commit

Permalink
test: refine test (pingcap#7414)
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycs520 authored and coocood committed Aug 16, 2018
1 parent 3d7d81c commit 6e7d752
Show file tree
Hide file tree
Showing 20 changed files with 96 additions and 96 deletions.
12 changes: 6 additions & 6 deletions ddl/db_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func (s *testIntegrationSuite) TestInvalidDefault(c *C) {

_, err := tk.Exec("create table t(c1 decimal default 1.7976931348623157E308)")
c.Assert(err, NotNil)
c.Assert(terror.ErrorEqual(err, types.ErrInvalidDefault), IsTrue)
c.Assert(terror.ErrorEqual(err, types.ErrInvalidDefault), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("create table t( c1 varchar(2) default 'TiDB');")
c.Assert(err, NotNil)
c.Assert(terror.ErrorEqual(err, types.ErrInvalidDefault), IsTrue)
c.Assert(terror.ErrorEqual(err, types.ErrInvalidDefault), IsTrue, Commentf("err %v", err))
}

// for issue #3848
Expand All @@ -87,15 +87,15 @@ func (s *testIntegrationSuite) TestInvalidNameWhenCreateTable(c *C) {

_, err := tk.Exec("create table t(xxx.t.a bigint)")
c.Assert(err, NotNil)
c.Assert(terror.ErrorEqual(err, ddl.ErrWrongDBName), IsTrue)
c.Assert(terror.ErrorEqual(err, ddl.ErrWrongDBName), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("create table t(test.tttt.a bigint)")
c.Assert(err, NotNil)
c.Assert(terror.ErrorEqual(err, ddl.ErrWrongTableName), IsTrue)
c.Assert(terror.ErrorEqual(err, ddl.ErrWrongTableName), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("create table t(t.tttt.a bigint)")
c.Assert(err, NotNil)
c.Assert(terror.ErrorEqual(err, ddl.ErrWrongDBName), IsTrue)
c.Assert(terror.ErrorEqual(err, ddl.ErrWrongDBName), IsTrue, Commentf("err %v", err))
}

// for issue #6879
Expand All @@ -112,7 +112,7 @@ func (s *testIntegrationSuite) TestCreateTableIfNotExists(c *C) {
warnings := tk.Se.GetSessionVars().StmtCtx.GetWarnings()
c.Assert(len(warnings), GreaterEqual, 1)
lastWarn := warnings[len(warnings)-1]
c.Assert(terror.ErrorEqual(infoschema.ErrTableExists, lastWarn.Err), IsTrue)
c.Assert(terror.ErrorEqual(infoschema.ErrTableExists, lastWarn.Err), IsTrue, Commentf("err %v", lastWarn.Err))
c.Assert(lastWarn.Level, Equals, stmtctx.WarnLevelNote)

// Test duplicate create-table without `LIKE` clause
Expand Down
2 changes: 1 addition & 1 deletion ddl/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func (s *testSchemaSuite) TestSchema(c *C) {
BinlogInfo: &model.HistoryInfo{},
}
err := d.doDDLJob(ctx, job)
c.Assert(terror.ErrorEqual(err, infoschema.ErrDatabaseDropExists), IsTrue)
c.Assert(terror.ErrorEqual(err, infoschema.ErrDatabaseDropExists), IsTrue, Commentf("err %v", err))

// Drop a database without a table.
dbInfo1 := testSchemaInfo(c, d, "test1")
Expand Down
46 changes: 23 additions & 23 deletions executor/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,39 +442,39 @@ func (s *testSuite) TestOnlyFullGroupBy(c *C) {
// test incompatible with sql_mode = ONLY_FULL_GROUP_BY
var err error
_, err = tk.Exec("select * from t group by d")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select b-c from t group by b+c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select (b-c)*(b+c), min(a) from t group by b+c, b-c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select b between c and d from t group by b,c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select case b when 1 then c when 2 then d else d end from t group by b,c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select c > (select b from t) from t group by b")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select c is null from t group by b")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select c is true from t group by b")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select (c+b)*d from t group by c,d")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select b in (c,d) from t group by b,c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select b like '%a' from t group by c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select c REGEXP '1.*' from t group by b")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select -b from t group by c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select a, max(b) from t")
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select sum(a)+b from t")
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select count(b), c from t")
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select distinct a, b, count(a) from t")
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrMixOfGroupFuncAndFields), IsTrue, Commentf("err %v", err))
// test compatible with sql_mode = ONLY_FULL_GROUP_BY
tk.MustQuery("select a from t group by a,b,c")
tk.MustQuery("select b from t group by b")
Expand Down Expand Up @@ -503,15 +503,15 @@ func (s *testSuite) TestOnlyFullGroupBy(c *C) {
tk.MustQuery("select * from t group by b,d")
// test functional depend on a unique null column
_, err = tk.Exec("select * from t group by b,c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
// test functional dependency derived from keys in where condition
tk.MustQuery("select * from t where c = d group by b, c")
tk.MustQuery("select t.*, x.* from t, x where t.a = x.a group by t.a")
tk.MustQuery("select t.*, x.* from t, x where t.b = x.b and t.d = x.d group by t.b, t.d")
tk.MustQuery("select t.*, x.* from t, x where t.b = x.a group by t.b, t.d")
tk.MustQuery("select t.b, x.* from t, x where t.b = x.a group by t.b")
_, err = tk.Exec("select t.*, x.* from t, x where t.c = x.a group by t.b, t.c")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
// test functional dependency derived from keys in join
tk.MustQuery("select t.*, x.* from t inner join x on t.a = x.a group by t.a")
tk.MustQuery("select t.*, x.* from t inner join x on (t.b = x.b and t.d = x.d) group by t.b, x.d")
Expand All @@ -521,9 +521,9 @@ func (s *testSuite) TestOnlyFullGroupBy(c *C) {
tk.MustQuery("select x.b, t.* from t right join x on x.b = t.b group by x.b, t.d")
tk.MustQuery("select x.b, t.* from t right join x on t.b = x.b group by x.b, t.d")
_, err = tk.Exec("select t.b, x.* from t right join x on t.b = x.b group by t.b, x.d")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("select t.b, x.* from t right join x on t.b = x.b group by t.b, x.d")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))

// FixMe: test functional dependency of derived table
//tk.MustQuery("select * from (select * from t) as e group by a")
Expand All @@ -534,10 +534,10 @@ func (s *testSuite) TestOnlyFullGroupBy(c *C) {
// test order by
tk.MustQuery("select c from t group by c,d order by d")
_, err = tk.Exec("select c from t group by c order by d")
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrFieldNotInGroupBy), IsTrue, Commentf("err %v", err))
// test ambiguous column
_, err = tk.Exec("select c from t,x group by t.c")
c.Assert(terror.ErrorEqual(err, plan.ErrAmbiguous), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrAmbiguous), IsTrue, Commentf("err %v", err))
}

func (s *testSuite) TestHaving(c *C) {
Expand Down
4 changes: 2 additions & 2 deletions executor/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,11 +411,11 @@ func (s *testSuite) TestSetDDLReorgWorkerCnt(c *C) {
tk.MustExec("set tidb_ddl_reorg_worker_cnt = 100")
c.Assert(variable.GetDDLReorgWorkerCounter(), Equals, int32(100))
_, err := tk.Exec("set tidb_ddl_reorg_worker_cnt = invalid_val")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue, Commentf("err %v", err))
tk.MustExec("set tidb_ddl_reorg_worker_cnt = 100")
c.Assert(variable.GetDDLReorgWorkerCounter(), Equals, int32(100))
_, err = tk.Exec("set tidb_ddl_reorg_worker_cnt = -1")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue, Commentf("err %v", err))

tk.MustExec("set tidb_ddl_reorg_worker_cnt = 100")
res := tk.MustQuery("select @@tidb_ddl_reorg_worker_cnt")
Expand Down
10 changes: 5 additions & 5 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,7 @@ func (s *testSuite) TestUnion(c *C) {
c.Assert(terr.Code(), Equals, terror.ErrCode(mysql.ErrWrongUsage))

_, err = tk.Exec("(select a from t order by a) union all select a from t limit 1 union all select a from t limit 1")
c.Assert(terror.ErrorEqual(err, plan.ErrWrongUsage), IsTrue)
c.Assert(terror.ErrorEqual(err, plan.ErrWrongUsage), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("(select a from t limit 1) union all select a from t limit 1")
c.Assert(err, IsNil)
Expand Down Expand Up @@ -1821,7 +1821,7 @@ func (s *testSuite) TestHistoryRead(c *C) {

// Set snapshot to a time before save point will fail.
_, err := tk.Exec("set @@tidb_snapshot = '2006-01-01 15:04:05.999999'")
c.Assert(terror.ErrorEqual(err, variable.ErrSnapshotTooOld), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrSnapshotTooOld), IsTrue, Commentf("err %v", err))
// SnapshotTS Is not updated if check failed.
c.Assert(tk.Se.GetSessionVars().SnapshotTS, Equals, uint64(0))

Expand Down Expand Up @@ -1991,7 +1991,7 @@ func (s *testSuite) TestTiDBCurrentTS(c *C) {
tk.MustQuery("select @@tidb_current_ts").Check(testkit.Rows("0"))

_, err := tk.Exec("set @@tidb_current_ts = '1'")
c.Assert(terror.ErrorEqual(err, variable.ErrReadOnly), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrReadOnly), IsTrue, Commentf("err %v", err))
}

func (s *testSuite) TestSelectForUpdate(c *C) {
Expand Down Expand Up @@ -2074,9 +2074,9 @@ func (s *testSuite) TestEmptyEnum(c *C) {
tk.MustExec("create table t (e enum('Y', 'N'))")
tk.MustExec("set sql_mode='STRICT_TRANS_TABLES'")
_, err := tk.Exec("insert into t values (0)")
c.Assert(terror.ErrorEqual(err, table.ErrTruncatedWrongValueForField), IsTrue)
c.Assert(terror.ErrorEqual(err, table.ErrTruncatedWrongValueForField), IsTrue, Commentf("err %v", err))
_, err = tk.Exec("insert into t values ('abc')")
c.Assert(terror.ErrorEqual(err, table.ErrTruncatedWrongValueForField), IsTrue)
c.Assert(terror.ErrorEqual(err, table.ErrTruncatedWrongValueForField), IsTrue, Commentf("err %v", err))

tk.MustExec("set sql_mode=''")
tk.MustExec("insert into t values (0)")
Expand Down
2 changes: 1 addition & 1 deletion executor/prepared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s *testSuite) TestPrepared(c *C) {

// incorrect SQLs in prepare. issue #3738, SQL in prepare stmt is parsed in DoPrepare.
_, err = tk.Exec(`prepare p from "delete from t where a = 7 or 1=1/*' and b = 'p'";`)
c.Assert(terror.ErrorEqual(err, errors.New(`[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' and b = 'p'' at line 1`)), IsTrue)
c.Assert(terror.ErrorEqual(err, errors.New(`[parser:1064]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '/*' and b = 'p'' at line 1`)), IsTrue, Commentf("err %v", err))

// The `stmt_test5` should not be found.
_, err = tk.Exec(`set @a = 1; execute stmt_test_5 using @a;`)
Expand Down
22 changes: 11 additions & 11 deletions executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,42 +252,42 @@ func (s *testSuite) TestValidateSetVar(c *C) {
tk := testkit.NewTestKit(c, s.store)

_, err := tk.Exec("set global tidb_distsql_scan_concurrency='fff';")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("set global tidb_distsql_scan_concurrency=-1;")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("set @@tidb_distsql_scan_concurrency='fff';")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("set @@tidb_distsql_scan_concurrency=-1;")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("set @@tidb_batch_delete='ok';")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue, Commentf("err %v", err))

tk.MustExec("set @@tidb_batch_delete='On';")
tk.MustExec("set @@tidb_batch_delete='oFf';")
tk.MustExec("set @@tidb_batch_delete=1;")
tk.MustExec("set @@tidb_batch_delete=0;")

_, err = tk.Exec("set @@tidb_batch_delete=3;")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("set @@tidb_mem_quota_mergejoin='tidb';")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongValueForVar), IsTrue, Commentf("err %v", err))

tk.MustExec("set @@group_concat_max_len=1")
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning|1292|Truncated incorrect group_concat_max_len value: '1'"))
result := tk.MustQuery("select @@group_concat_max_len;")
result.Check(testkit.Rows("4"))

_, err = tk.Exec("set @@group_concat_max_len = 18446744073709551616")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue, Commentf("err %v", err))

// Test illegal type
_, err = tk.Exec("set @@group_concat_max_len='hello'")
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrWrongTypeForVar), IsTrue, Commentf("err %v", err))

tk.MustExec("set @@default_week_format=-1")
tk.MustQuery("show warnings").Check(testutil.RowsWithSep("|", "Warning|1292|Truncated incorrect default_week_format value: '-1'"))
Expand All @@ -300,10 +300,10 @@ func (s *testSuite) TestValidateSetVar(c *C) {
result.Check(testkit.Rows("7"))

_, err = tk.Exec("set @@error_count = 0")
c.Assert(terror.ErrorEqual(err, variable.ErrReadOnly), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrReadOnly), IsTrue, Commentf("err %v", err))

_, err = tk.Exec("set @@warning_count = 0")
c.Assert(terror.ErrorEqual(err, variable.ErrReadOnly), IsTrue)
c.Assert(terror.ErrorEqual(err, variable.ErrReadOnly), IsTrue, Commentf("err %v", err))

tk.MustExec("set time_zone='SySTeM'")
result = tk.MustQuery("select @@time_zone;")
Expand Down
8 changes: 4 additions & 4 deletions executor/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func (s *testSuite) TestUser(c *C) {
// Test 'identified by password'
createUserSQL = `CREATE USER 'test1'@'localhost' identified by password 'xxx';`
_, err = tk.Exec(createUserSQL)
c.Assert(terror.ErrorEqual(executor.ErrPasswordFormat, err), IsTrue)
c.Assert(terror.ErrorEqual(executor.ErrPasswordFormat, err), IsTrue, Commentf("err %v", err))
createUserSQL = `CREATE USER 'test1'@'localhost' identified by password '*3D56A309CD04FA2EEF181462E59011F075C89548';`
tk.MustExec(createUserSQL)
dropUserSQL = `DROP USER 'test1'@'localhost';`
Expand All @@ -187,7 +187,7 @@ func (s *testSuite) TestUser(c *C) {

// Test drop user meet error
_, err = tk.Exec(dropUserSQL)
c.Assert(terror.ErrorEqual(err, executor.ErrCannotUser.GenByArgs("DROP USER", "")), IsTrue)
c.Assert(terror.ErrorEqual(err, executor.ErrCannotUser.GenByArgs("DROP USER", "")), IsTrue, Commentf("err %v", err))

createUserSQL = `CREATE USER 'test1'@'localhost'`
tk.MustExec(createUserSQL)
Expand All @@ -196,7 +196,7 @@ func (s *testSuite) TestUser(c *C) {

dropUserSQL = `DROP USER 'test1'@'localhost', 'test2'@'localhost', 'test3'@'localhost';`
_, err = tk.Exec(dropUserSQL)
c.Assert(terror.ErrorEqual(err, executor.ErrCannotUser.GenByArgs("DROP USER", "")), IsTrue)
c.Assert(terror.ErrorEqual(err, executor.ErrCannotUser.GenByArgs("DROP USER", "")), IsTrue, Commentf("err %v", err))
}

func (s *testSuite) TestSetPwd(c *C) {
Expand All @@ -223,7 +223,7 @@ func (s *testSuite) TestSetPwd(c *C) {
ctx.GetSessionVars().User = &auth.UserIdentity{Username: "testpwd1", Hostname: "localhost"}
// Session user doesn't exist.
_, err = tk.Exec(setPwdSQL)
c.Check(terror.ErrorEqual(err, executor.ErrPasswordNoMatch), IsTrue)
c.Check(terror.ErrorEqual(err, executor.ErrPasswordNoMatch), IsTrue, Commentf("err %v", err))
// normal
ctx.GetSessionVars().User = &auth.UserIdentity{Username: "testpwd", Hostname: "localhost"}
tk.MustExec(setPwdSQL)
Expand Down
2 changes: 1 addition & 1 deletion executor/statement_context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *testSuite) TestStatementContext(c *C) {
tk.MustExec(strictModeSQL)
_, err = tk.Exec("insert sc2 values (unhex('4040ffff'))")
c.Assert(err, NotNil)
c.Assert(terror.ErrorEqual(err, table.ErrTruncateWrongValue), IsTrue)
c.Assert(terror.ErrorEqual(err, table.ErrTruncateWrongValue), IsTrue, Commentf("err %v", err))

tk.MustExec("set @@tidb_skip_utf8_check = '1'")
_, err = tk.Exec("insert sc2 values (unhex('4040ffff'))")
Expand Down
Loading

0 comments on commit 6e7d752

Please sign in to comment.