Skip to content

Commit

Permalink
*: remove the t.Run (pingcap#31895)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkingrei authored Jan 22, 2022
1 parent 7f44207 commit 9c73e5e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 30 deletions.
3 changes: 1 addition & 2 deletions domain/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import (
"github.com/stretchr/testify/require"
)

// SubTestDomainSession is batched in TestDomainSerial
func SubTestDomainSession(t *testing.T) {
func TestDomainSession(t *testing.T) {
lease := 50 * time.Millisecond
store, err := mockstore.NewMockStore()
require.NoError(t, err)
Expand Down
6 changes: 2 additions & 4 deletions domain/domain_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ import (
"go.etcd.io/etcd/integration"
)

// SubTestInfo is batched in TestDomainSerial
func SubTestInfo(t *testing.T) {
func TestInfo(t *testing.T) {
if runtime.GOOS == "windows" {
t.Skip("integration.NewClusterV3 will create file contains a colon which is not allowed on Windows")
}
Expand Down Expand Up @@ -154,8 +153,7 @@ func SubTestInfo(t *testing.T) {
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/domain/infosync/FailPlacement"))
}

// SubTestDomain is batched in TestDomainSerial
func SubTestDomain(t *testing.T) {
func TestDomain(t *testing.T) {
store, err := mockstore.NewMockStore()
require.NoError(t, err)

Expand Down
9 changes: 0 additions & 9 deletions domain/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ package domain_test
import (
"testing"

. "github.com/pingcap/tidb/domain"
"github.com/pingcap/tidb/util/testbridge"
"go.uber.org/goleak"
)
Expand All @@ -30,11 +29,3 @@ func TestMain(m *testing.M) {
}
goleak.VerifyTestMain(m, opts...)
}

// TestDomainSerial handles tests in serial
func TestDomainSerial(t *testing.T) {
// these tests should run in serial for failpoint is global
t.Run("info", SubTestInfo)
t.Run("domain", SubTestDomain)
t.Run("domainSession", SubTestDomainSession)
}
21 changes: 6 additions & 15 deletions executor/executor_pkg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,7 @@ func (msm *mockSessionManager) SetServerID(serverID uint64) {
msm.serverID = serverID
}

func TestExecutorPkg(t *testing.T) {
t.Run("ShowProcessList", SubTestShowProcessList)
t.Run("BuildKvRangesForIndexJoinWithoutCwc", SubTestBuildKvRangesForIndexJoinWithoutCwc)
t.Run("GetFieldsFromLine", SubTestGetFieldsFromLine)
t.Run("SlowQueryRuntimeStats", SubTestSlowQueryRuntimeStats)
t.Run("AggPartialResultMapperB", SubTestAggPartialResultMapperB)
t.Run("FilterTemporaryTableKeys", SubTestFilterTemporaryTableKeys)
}

func SubTestShowProcessList(t *testing.T) {
func TestShowProcessList(t *testing.T) {
// Compose schema.
names := []string{"Id", "User", "Host", "db", "Command", "Time", "State", "Info"}
ftypes := []byte{mysql.TypeLonglong, mysql.TypeVarchar, mysql.TypeVarchar,
Expand Down Expand Up @@ -180,7 +171,7 @@ func buildSchema(names []string, ftypes []byte) *expression.Schema {
return schema
}

func SubTestBuildKvRangesForIndexJoinWithoutCwc(t *testing.T) {
func TestBuildKvRangesForIndexJoinWithoutCwc(t *testing.T) {
indexRanges := make([]*ranger.Range, 0, 6)
indexRanges = append(indexRanges, generateIndexRange(1, 1, 1, 1, 1))
indexRanges = append(indexRanges, generateIndexRange(1, 1, 2, 1, 1))
Expand Down Expand Up @@ -224,7 +215,7 @@ func generateDatumSlice(vals ...int64) []types.Datum {
return datums
}

func SubTestGetFieldsFromLine(t *testing.T) {
func TestGetFieldsFromLine(t *testing.T) {
tests := []struct {
input string
expected []string
Expand Down Expand Up @@ -282,7 +273,7 @@ func assertEqualStrings(t *testing.T, got []field, expect []string) {
}
}

func SubTestSlowQueryRuntimeStats(t *testing.T) {
func TestSlowQueryRuntimeStats(t *testing.T) {
stats := &slowQueryRuntimeStats{
totalFileNum: 2,
readFileNum: 2,
Expand All @@ -300,7 +291,7 @@ func SubTestSlowQueryRuntimeStats(t *testing.T) {

// Test whether the actual buckets in Golang Map is same with the estimated number.
// The test relies the implement of Golang Map. ref https://github.com/golang/go/blob/go1.13/src/runtime/map.go#L114
func SubTestAggPartialResultMapperB(t *testing.T) {
func TestAggPartialResultMapperB(t *testing.T) {
if runtime.Version() < `go1.13` {
t.Skip("Unsupported version")
}
Expand Down Expand Up @@ -392,7 +383,7 @@ func getGrowing(m aggPartialResultMapper) bool {
return value.oldbuckets != nil
}

func SubTestFilterTemporaryTableKeys(t *testing.T) {
func TestFilterTemporaryTableKeys(t *testing.T) {
vars := variable.NewSessionVars()
const tableID int64 = 3
vars.TxnCtx = &variable.TransactionContext{
Expand Down

0 comments on commit 9c73e5e

Please sign in to comment.