Skip to content

Commit 58f5632

Browse files
authored
executor: make TestShowAnalyzeStatus more stable (#11090)
If TestShowAnalyzeStatus run parallelly with others, the results would be affected. use a new testShowStatsSuite for it.
1 parent 985c021 commit 58f5632

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

executor/executor_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ var _ = Suite(&testOOMSuite{})
9898
var _ = Suite(&testPointGetSuite{})
9999
var _ = Suite(&testRecoverTable{})
100100
var _ = Suite(&testFlushSuite{})
101+
var _ = Suite(&testShowStatsSuite{})
101102

102103
type testSuite struct {
103104
cluster *mocktikv.Cluster

executor/show_stats_test.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ import (
1919
"github.com/pingcap/tidb/util/testkit"
2020
)
2121

22-
func (s *testSuite1) TestShowStatsMeta(c *C) {
22+
type testShowStatsSuite struct {
23+
testSuite
24+
}
25+
26+
func (s *testShowStatsSuite) TestShowStatsMeta(c *C) {
2327
tk := testkit.NewTestKit(c, s.store)
2428
tk.MustExec("use test")
2529
tk.MustExec("drop table if exists t, t1")
@@ -35,7 +39,7 @@ func (s *testSuite1) TestShowStatsMeta(c *C) {
3539
c.Assert(result.Rows()[0][1], Equals, "t")
3640
}
3741

38-
func (s *testSuite1) TestShowStatsHistograms(c *C) {
42+
func (s *testShowStatsSuite) TestShowStatsHistograms(c *C) {
3943
tk := testkit.NewTestKit(c, s.store)
4044
tk.MustExec("use test")
4145
tk.MustExec("drop table if exists t")
@@ -63,7 +67,7 @@ func (s *testSuite1) TestShowStatsHistograms(c *C) {
6367
c.Assert(len(res.Rows()), Equals, 1)
6468
}
6569

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

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

140-
func (s *testSuite1) TestShowPartitionStats(c *C) {
144+
func (s *testShowStatsSuite) TestShowPartitionStats(c *C) {
141145
tk := testkit.NewTestKit(c, s.store)
142146
tk.MustExec("set @@session.tidb_enable_table_partition=1")
143147
tk.MustExec("use test")
@@ -170,7 +174,7 @@ func (s *testSuite1) TestShowPartitionStats(c *C) {
170174
result.Check(testkit.Rows("test t p0 100"))
171175
}
172176

173-
func (s *testSuite1) TestShowAnalyzeStatus(c *C) {
177+
func (s *testShowStatsSuite) TestShowAnalyzeStatus(c *C) {
174178
tk := testkit.NewTestKit(c, s.store)
175179
statistics.ClearHistoryJobs()
176180
tk.MustExec("use test")

0 commit comments

Comments
 (0)