From 24380b6bf26230ea5509d87e41951f740afa02d1 Mon Sep 17 00:00:00 2001 From: Haibin Xie Date: Fri, 9 Aug 2019 11:40:03 +0800 Subject: [PATCH] executor: make TestShowAnalyzeStatus more stable (#11090) (#11684) --- executor/executor_test.go | 1 + executor/show_stats_test.go | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/executor/executor_test.go b/executor/executor_test.go index 459424924a301..3294260b7d447 100644 --- a/executor/executor_test.go +++ b/executor/executor_test.go @@ -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 diff --git a/executor/show_stats_test.go b/executor/show_stats_test.go index fcd2e1beb0a2b..529671f385dc8 100644 --- a/executor/show_stats_test.go +++ b/executor/show_stats_test.go @@ -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") @@ -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") @@ -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") @@ -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))") @@ -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") @@ -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")