Skip to content

Commit

Permalink
executor: Speed up unit tests (#14357)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxbest authored and sre-bot committed Jan 6, 2020
1 parent 0feafcf commit 39ed9f3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion executor/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ func (s *testSuite6) TestTimestampMinDefaultValue(c *C) {
tk.MustExec("ALTER TABLE tdv ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';")
}

func (s *testSuite3) TestRenameTable(c *C) {
func (s *testSuiteP1) TestRenameTable(c *C) {
c.Assert(failpoint.Enable("github.com/pingcap/tidb/meta/autoid/mockAutoIDChange", `return(true)`), IsNil)
defer func() {
c.Assert(failpoint.Disable("github.com/pingcap/tidb/meta/autoid/mockAutoIDChange"), IsNil)
Expand Down
2 changes: 1 addition & 1 deletion executor/distsql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (s *testSuite3) TestCorColToRanges(c *C) {
tk.MustQuery("select t.c in (select count(*) from t s use index(idx), t t1 where s.b = t.a and s.c = t1.a) from t").Check(testkit.Rows("1", "0", "0", "0", "0", "0", "0", "0", "0"))
}

func (s *testSuite3) TestUniqueKeyNullValueSelect(c *C) {
func (s *testSuiteP1) TestUniqueKeyNullValueSelect(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
Expand Down
10 changes: 5 additions & 5 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (s *testSuiteP1) TestShow(c *C) {
c.Assert(len(tk.MustQuery("show table status").Rows()), Equals, 1)
}

func (s *testSuiteP1) TestAdmin(c *C) {
func (s *testSuite3) TestAdmin(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists admin_test")
Expand Down Expand Up @@ -3552,7 +3552,7 @@ func (s *testSuite3) TestIndexJoinTableDualPanic(c *C) {
Check(testkit.Rows("1 a"))
}

func (s *testSuite3) TestUnionAutoSignedCast(c *C) {
func (s *testSuiteP1) TestUnionAutoSignedCast(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t1,t2")
Expand Down Expand Up @@ -3592,7 +3592,7 @@ func (s *testSuite3) TestUnionAutoSignedCast(c *C) {
Check(testkit.Rows("1 1", "2 -1", "3 -1"))
}

func (s *testSuite3) TestUpdateJoin(c *C) {
func (s *testSuite6) TestUpdateJoin(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t1, t2, t3, t4, t5, t6, t7")
Expand Down Expand Up @@ -3685,7 +3685,7 @@ func (s *testSuite3) TestMaxOneRow(c *C) {
c.Assert(err, IsNil)
}

func (s *testSuite3) TestCurrentTimestampValueSelection(c *C) {
func (s *testSuiteP2) TestCurrentTimestampValueSelection(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t,t1")
Expand Down Expand Up @@ -3783,7 +3783,7 @@ func (s *testSuite3) TestSelectHashPartitionTable(c *C) {
tk.MustQuery(" select * from th where a=5;").Check(testkit.Rows("5 5"))
}

func (s *testSuite3) TestSelectPartition(c *C) {
func (s *testSuiteP1) TestSelectPartition(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec(`use test`)
tk.MustExec(`drop table if exists th, tr`)
Expand Down
4 changes: 2 additions & 2 deletions executor/grant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/pingcap/tidb/util/testkit"
)

func (s *testSuite3) TestGrantGlobal(c *C) {
func (s *testSuiteP1) TestGrantGlobal(c *C) {
tk := testkit.NewTestKit(c, s.store)
// Create a new user.
createUserSQL := `CREATE USER 'testGlobal'@'localhost' IDENTIFIED BY '123';`
Expand Down Expand Up @@ -111,7 +111,7 @@ func (s *testSuite3) TestWithGrantOption(c *C) {
tk.MustQuery("SELECT grant_priv FROM mysql.user WHERE User=\"testWithGrant1\"").Check(testkit.Rows("Y"))
}

func (s *testSuite3) TestTableScope(c *C) {
func (s *testSuiteP1) TestTableScope(c *C) {
tk := testkit.NewTestKit(c, s.store)
// Create a new user.
createUserSQL := `CREATE USER 'testTbl'@'localhost' IDENTIFIED BY '123';`
Expand Down
4 changes: 2 additions & 2 deletions executor/insert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (s *testSuite3) TestInsertZeroYear(c *C) {
))
}

func (s *testSuite3) TestAllowInvalidDates(c *C) {
func (s *testSuiteP1) TestAllowInvalidDates(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec(`use test`)
tk.MustExec(`drop table if exists t1, t2, t3, t4;`)
Expand Down Expand Up @@ -765,7 +765,7 @@ func (s *testSuite3) TestBit(c *C) {

}

func (s *testSuite3) TestAllocateContinuousRowID(c *C) {
func (s *testSuiteP1) TestAllocateContinuousRowID(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec(`use test`)
tk.MustExec(`create table t1 (a int,b int, key I_a(a));`)
Expand Down
4 changes: 2 additions & 2 deletions executor/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func inTxn(ctx sessionctx.Context) bool {
return (ctx.GetSessionVars().Status & mysql.ServerStatusInTrans) > 0
}

func (s *testSuite3) TestRole(c *C) {
func (s *testSuite6) TestRole(c *C) {
tk := testkit.NewTestKit(c, s.store)
// Make sure user test not in mysql.User.
result := tk.MustQuery(`SELECT Password FROM mysql.User WHERE User="test" and Host="localhost"`)
Expand Down Expand Up @@ -311,7 +311,7 @@ func (s *testSuite3) TestDefaultRole(c *C) {
tk.MustExec(dropRoleSQL)
}

func (s *testSuite3) TestUser(c *C) {
func (s *testSuite7) TestUser(c *C) {
tk := testkit.NewTestKit(c, s.store)
// Make sure user test not in mysql.User.
result := tk.MustQuery(`SELECT Password FROM mysql.User WHERE User="test" and Host="localhost"`)
Expand Down
8 changes: 4 additions & 4 deletions executor/write_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type testBypassSuite struct{}
func (s *testBypassSuite) SetUpSuite(c *C) {
}

func (s *testSuite4) TestInsert(c *C) {
func (s *testSuite) TestInsert(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
testSQL := `drop table if exists insert_test;create table insert_test (id int PRIMARY KEY AUTO_INCREMENT, c1 int, c2 int, c3 int default 1);`
Expand Down Expand Up @@ -560,7 +560,7 @@ commit;`
tk.MustQuery(testSQL).Check(testkit.Rows("0"))
}

func (s *testSuite4) TestInsertOnDup(c *C) {
func (s *testSuite8) TestInsertOnDup(c *C) {
var cfg kv.InjectionConfig
tk := testkit.NewTestKit(c, kv.NewInjectedStore(s.store, &cfg))
tk.MustExec("use test")
Expand Down Expand Up @@ -830,7 +830,7 @@ func (s *testSuite4) TestInsertOnDupUpdateDefault(c *C) {
tk.MustExec("drop table t1, t2")
}

func (s *testSuite4) TestReplace(c *C) {
func (s *testSuite6) TestReplace(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
testSQL := `drop table if exists replace_test;
Expand Down Expand Up @@ -1931,7 +1931,7 @@ func (s *testSuite4) TestQualifiedDelete(c *C) {
c.Assert(err, NotNil)
}

func (s *testSuite4) TestLoadDataMissingColumn(c *C) {
func (s *testSuite8) TestLoadDataMissingColumn(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
createSQL := `create table load_data_missing (id int, t timestamp not null)`
Expand Down

0 comments on commit 39ed9f3

Please sign in to comment.