Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statstest: make test faster #45772

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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