Skip to content

Commit

Permalink
executor: make TestShowAnalyzeStatus more stable (#11090) (#11684)
Browse files Browse the repository at this point in the history
  • Loading branch information
alivxxx authored and sre-bot committed Aug 9, 2019
1 parent 00801a7 commit 24380b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ var _ = Suite(&testUpdateSuite{})
var _ = Suite(&testOOMSuite{})
var _ = Suite(&testPointGetSuite{})
var _ = Suite(&testFlushSuite{})
var _ = SerialSuites(&testShowStatsSuite{})

type testSuite struct {
cluster *mocktikv.Cluster
Expand Down
16 changes: 10 additions & 6 deletions executor/show_stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ import (
"github.com/pingcap/tidb/util/testkit"
)

func (s *testSuite1) TestShowStatsMeta(c *C) {
type testShowStatsSuite struct {
testSuite
}

func (s *testShowStatsSuite) TestShowStatsMeta(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t, t1")
Expand All @@ -35,7 +39,7 @@ func (s *testSuite1) TestShowStatsMeta(c *C) {
c.Assert(result.Rows()[0][1], Equals, "t")
}

func (s *testSuite1) TestShowStatsHistograms(c *C) {
func (s *testShowStatsSuite) TestShowStatsHistograms(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
Expand Down Expand Up @@ -63,7 +67,7 @@ func (s *testSuite1) TestShowStatsHistograms(c *C) {
c.Assert(len(res.Rows()), Equals, 1)
}

func (s *testSuite1) TestShowStatsBuckets(c *C) {
func (s *testShowStatsSuite) TestShowStatsBuckets(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("drop table if exists t")
Expand All @@ -77,7 +81,7 @@ func (s *testSuite1) TestShowStatsBuckets(c *C) {
result.Check(testkit.Rows("test t idx 1 0 1 1 (1, 1) (1, 1)"))
}

func (s *testSuite1) TestShowStatsHasNullValue(c *C) {
func (s *testShowStatsSuite) TestShowStatsHasNullValue(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("use test")
tk.MustExec("create table t (a int, index idx(a))")
Expand Down Expand Up @@ -137,7 +141,7 @@ func (s *testSuite1) TestShowStatsHasNullValue(c *C) {
c.Assert(res.Rows()[4][7], Equals, "0")
}

func (s *testSuite1) TestShowPartitionStats(c *C) {
func (s *testShowStatsSuite) TestShowPartitionStats(c *C) {
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("set @@session.tidb_enable_table_partition=1")
tk.MustExec("use test")
Expand Down Expand Up @@ -170,7 +174,7 @@ func (s *testSuite1) TestShowPartitionStats(c *C) {
result.Check(testkit.Rows("test t p0 100"))
}

func (s *testSuite1) TestShowAnalyzeStatus(c *C) {
func (s *testShowStatsSuite) TestShowAnalyzeStatus(c *C) {
tk := testkit.NewTestKit(c, s.store)
statistics.ClearHistoryJobs()
tk.MustExec("use test")
Expand Down

0 comments on commit 24380b6

Please sign in to comment.