Skip to content

Commit

Permalink
statstest: make test faster (#45772)
Browse files Browse the repository at this point in the history
ref #44940
  • Loading branch information
hawkingrei committed Aug 3, 2023
1 parent 41accbe commit d43359a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion statistics/handle/handletest/statstest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ go_test(
],
flaky = True,
race = "on",
shard_count = 8,
shard_count = 9,
deps = [
"//config",
"//parser/model",
Expand Down
16 changes: 11 additions & 5 deletions statistics/handle/handletest/statstest/stats_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,21 @@ func testInitStatsMemTrace(t *testing.T) {
require.Equal(t, h.GetMemConsumed(), memCostTot)
}

func TestInitStatsMemTrace(t *testing.T) {
func TestInitStatsMemTraceWithLite(t *testing.T) {
testInitStatsMemTraceFunc(t, true)
}

func TestInitStatsMemTraceWithoutLite(t *testing.T) {
testInitStatsMemTraceFunc(t, false)
}

func testInitStatsMemTraceFunc(t *testing.T, liteInitStats bool) {
originValue := config.GetGlobalConfig().Performance.LiteInitStats
defer func() {
config.GetGlobalConfig().Performance.LiteInitStats = originValue
}()
for _, v := range []bool{false, true} {
config.GetGlobalConfig().Performance.LiteInitStats = v
testInitStatsMemTrace(t)
}
config.GetGlobalConfig().Performance.LiteInitStats = liteInitStats
testInitStatsMemTrace(t)
}

func TestInitStats(t *testing.T) {
Expand Down

0 comments on commit d43359a

Please sign in to comment.