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

Makefile: add t.Parallel check to ensure tests are run in serial #30869

Merged
merged 9 commits into from
Dec 22, 2021
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ dev: checklist check explaintest devgotest gogenerate br_unit_test test_part_par
# Install the check tools.
check-setup:tools/bin/revive tools/bin/goword

check: fmt unconvert lint tidy testSuite check-static vet errdoc
check: fmt check-parallel unconvert lint tidy testSuite check-static vet errdoc

fmt:
@echo "gofmt (simplify)"
Expand Down Expand Up @@ -75,6 +75,13 @@ testSuite:
@echo "testSuite"
./tools/check/check_testSuite.sh

check-parallel:
# Make sure no tests are run in parallel to prevent possible unstable tests.
# See https://github.com/pingcap/tidb/pull/30692.
@! find . -name "*_test.go" -not -path "./vendor/*" -print0 | \
xargs -0 grep -F -n "t.Parallel()" || \
! echo "Error: all the go tests should be run in serial."

clean: failpoint-disable
$(GO) clean -i ./...

Expand Down
4 changes: 0 additions & 4 deletions br/pkg/task/backup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
)

func TestParseTSString(t *testing.T) {
t.Parallel()

var (
ts uint64
err error
Expand All @@ -33,8 +31,6 @@ func TestParseTSString(t *testing.T) {
}

func TestParseCompressionType(t *testing.T) {
t.Parallel()

var (
ct backup.CompressionType
err error
Expand Down
5 changes: 0 additions & 5 deletions br/pkg/task/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func (f fakeValue) Type() string {
}

func TestUrlNoQuery(t *testing.T) {
t.Parallel()
flag := &pflag.Flag{
Name: flagStorage,
Value: fakeValue("s3://some/what?secret=a123456789&key=987654321"),
Expand All @@ -40,7 +39,6 @@ func TestUrlNoQuery(t *testing.T) {
}

func TestTiDBConfigUnchanged(t *testing.T) {
t.Parallel()
cfg := config.GetGlobalConfig()
restoreConfig := enableTiDBConfig()
require.NotEqual(t, config.GetGlobalConfig(), cfg)
Expand All @@ -49,7 +47,6 @@ func TestTiDBConfigUnchanged(t *testing.T) {
}

func TestStripingPDURL(t *testing.T) {
t.Parallel()
nor1, err := normalizePDURL("https://pd:5432", true)
require.NoError(t, err)
require.Equal(t, "pd:5432", nor1)
Expand All @@ -68,7 +65,6 @@ func TestStripingPDURL(t *testing.T) {
}

func TestCheckCipherKeyMatch(t *testing.T) {
t.Parallel()
cases := []struct {
CipherType encryptionpb.EncryptionMethod
CipherKey string
Expand Down Expand Up @@ -125,7 +121,6 @@ func TestCheckCipherKeyMatch(t *testing.T) {
}

func TestCheckCipherKey(t *testing.T) {
t.Parallel()
cases := []struct {
cipherKey string
keyFile string
Expand Down
2 changes: 0 additions & 2 deletions br/pkg/task/restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
)

func TestRestoreConfigAdjust(t *testing.T) {
t.Parallel()

cfg := &RestoreConfig{}
cfg.adjustRestoreConfig()

Expand Down