Skip to content

Commit

Permalink
testkit: set GOMAXPROCS in test (#39766)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Dec 9, 2022
1 parent f681af5 commit d176b38
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ddl/concurrentddltest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test")

go_test(
name = "concurrentddltest_test",
timeout = "moderate",
timeout = "long",
srcs = [
"main_test.go",
"switch_test.go",
Expand Down
2 changes: 1 addition & 1 deletion executor/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ go_library(

go_test(
name = "executor_test",
timeout = "moderate",
timeout = "long",
srcs = [
"adapter_test.go",
"admin_test.go",
Expand Down
2 changes: 1 addition & 1 deletion session/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ go_library(

go_test(
name = "session_test",
timeout = "short",
timeout = "moderate",
srcs = [
"bench_test.go",
"bootstrap_test.go",
Expand Down
1 change: 1 addition & 0 deletions testkit/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ go_library(
"//util/breakpoint",
"//util/chunk",
"//util/gctuner",
"//util/mathutil",
"//util/sqlexec",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
Expand Down
3 changes: 3 additions & 0 deletions testkit/testkit.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package testkit
import (
"context"
"fmt"
"runtime"
"strings"
"sync"
"testing"
Expand All @@ -32,6 +33,7 @@ import (
"github.com/pingcap/tidb/session"
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/mathutil"
"github.com/pingcap/tidb/util/sqlexec"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -54,6 +56,7 @@ type TestKit struct {

// NewTestKit returns a new *TestKit.
func NewTestKit(t testing.TB, store kv.Storage) *TestKit {
runtime.GOMAXPROCS(mathutil.Min(16, runtime.GOMAXPROCS(0)))
tk := &TestKit{
require: require.New(t),
assert: assert.New(t),
Expand Down

0 comments on commit d176b38

Please sign in to comment.