Skip to content

Commit

Permalink
test: make all the tests run in serial
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Dec 14, 2021
1 parent b626745 commit 55b20f2
Show file tree
Hide file tree
Showing 337 changed files with 0 additions and 3,204 deletions.
4 changes: 0 additions & 4 deletions br/pkg/conn/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ func TestCheckStoresAlive(t *testing.T) {
}

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

testCases := []struct {
stores []*metapb.Store
storeBehavior StoreBehavior
Expand Down Expand Up @@ -258,8 +256,6 @@ func TestGetAllTiKVStores(t *testing.T) {
}

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

ctx, cancel := context.WithCancel(context.Background())
cancel()

Expand Down
4 changes: 0 additions & 4 deletions br/pkg/kv/checksum_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import (
func uint64NotEqual(a uint64, b uint64) bool { return a != b }

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

checksum := kv.NewKVChecksum(0)
require.Equal(t, uint64(0), checksum.Sum())

Expand Down Expand Up @@ -69,8 +67,6 @@ func TestChecksum(t *testing.T) {
}

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

testStruct := &struct {
Checksum kv.Checksum
}{
Expand Down
4 changes: 0 additions & 4 deletions br/pkg/kv/kv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ import (
)

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

dats := make([]types.Datum, 4)
dats[0].SetInt64(1)
dats[1].SetNull()
Expand All @@ -43,8 +41,6 @@ func TestMarshal(t *testing.T) {
}

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

pairs := []Pair{
{Key: []byte("1"), Val: []byte("a")},
{Key: []byte("2"), Val: []byte("b")},
Expand Down
2 changes: 0 additions & 2 deletions br/pkg/kv/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
)

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

session := newSession(&SessionOptions{SQLMode: mysql.ModeNone, Timestamp: 1234567890, RowFormatVersion: "1"})
_, err := session.Txn(true)
require.NoError(t, err)
Expand Down
15 changes: 0 additions & 15 deletions br/pkg/lightning/backend/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func (s *backendSuite) tearDownTest() {
}

func TestOpenCloseImportCleanUpEngine(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()
ctx := context.Background()
Expand Down Expand Up @@ -72,7 +71,6 @@ func TestOpenCloseImportCleanUpEngine(t *testing.T) {
}

func TestUnsafeCloseEngine(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -94,7 +92,6 @@ func TestUnsafeCloseEngine(t *testing.T) {
}

func TestUnsafeCloseEngineWithUUID(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -116,7 +113,6 @@ func TestUnsafeCloseEngineWithUUID(t *testing.T) {
}

func TestWriteEngine(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand Down Expand Up @@ -155,7 +151,6 @@ func TestWriteEngine(t *testing.T) {
}

func TestWriteToEngineWithNothing(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -179,7 +174,6 @@ func TestWriteToEngineWithNothing(t *testing.T) {
}

func TestOpenEngineFailed(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -193,7 +187,6 @@ func TestOpenEngineFailed(t *testing.T) {
}

func TestWriteEngineFailed(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand Down Expand Up @@ -221,7 +214,6 @@ func TestWriteEngineFailed(t *testing.T) {
}

func TestWriteBatchSendFailedWithRetry(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand Down Expand Up @@ -249,7 +241,6 @@ func TestWriteBatchSendFailedWithRetry(t *testing.T) {
}

func TestImportFailedNoRetry(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -268,7 +259,6 @@ func TestImportFailedNoRetry(t *testing.T) {
}

func TestImportFailedWithRetry(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -289,7 +279,6 @@ func TestImportFailedWithRetry(t *testing.T) {
}

func TestImportFailedRecovered(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -312,7 +301,6 @@ func TestImportFailedRecovered(t *testing.T) {

//nolint:interfacer // change test case signature causes check panicking.
func TestClose(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -322,7 +310,6 @@ func TestClose(t *testing.T) {
}

func TestMakeEmptyRows(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -332,7 +319,6 @@ func TestMakeEmptyRows(t *testing.T) {
}

func TestNewEncoder(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand All @@ -346,7 +332,6 @@ func TestNewEncoder(t *testing.T) {
}

func TestCheckDiskQuota(t *testing.T) {
t.Parallel()
s := createBackendSuite(t)
defer s.tearDownTest()

Expand Down
5 changes: 0 additions & 5 deletions br/pkg/lightning/backend/importer/importer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func (s *importerSuite) tearDownTest() {
}

func TestWriteRows(t *testing.T) {
t.Parallel()
s := createImportSuite(t)
defer s.tearDownTest()

Expand Down Expand Up @@ -117,7 +116,6 @@ func TestWriteRows(t *testing.T) {
}

func TestWriteHeadSendFailed(t *testing.T) {
t.Parallel()
s := createImportSuite(t)
defer s.tearDownTest()

Expand All @@ -142,7 +140,6 @@ func TestWriteHeadSendFailed(t *testing.T) {
}

func TestWriteBatchSendFailed(t *testing.T) {
t.Parallel()
s := createImportSuite(t)
defer s.tearDownTest()

Expand Down Expand Up @@ -174,7 +171,6 @@ func TestWriteBatchSendFailed(t *testing.T) {
}

func TestWriteCloseFailed(t *testing.T) {
t.Parallel()
s := createImportSuite(t)
defer s.tearDownTest()

Expand Down Expand Up @@ -206,7 +202,6 @@ func TestWriteCloseFailed(t *testing.T) {
}

func TestCloseImportCleanupEngine(t *testing.T) {
t.Parallel()
s := createImportSuite(t)
defer s.tearDownTest()

Expand Down
11 changes: 0 additions & 11 deletions br/pkg/lightning/backend/tidb/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func (s *mysqlSuite) TearDownTest(t *testing.T) {
}

func TestWriteRowsReplaceOnDup(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.
Expand Down Expand Up @@ -132,7 +131,6 @@ func TestWriteRowsReplaceOnDup(t *testing.T) {
}

func TestWriteRowsIgnoreOnDup(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.
Expand Down Expand Up @@ -179,7 +177,6 @@ func TestWriteRowsIgnoreOnDup(t *testing.T) {
}

func TestWriteRowsErrorOnDup(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.
Expand Down Expand Up @@ -259,7 +256,6 @@ func testStrictMode(t *testing.T) {
}

func TestFetchRemoteTableModels_3_x(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.ExpectBegin()
Expand Down Expand Up @@ -294,7 +290,6 @@ func TestFetchRemoteTableModels_3_x(t *testing.T) {
}

func TestFetchRemoteTableModels_4_0(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.ExpectBegin()
Expand Down Expand Up @@ -332,7 +327,6 @@ func TestFetchRemoteTableModels_4_0(t *testing.T) {
}

func TestFetchRemoteTableModels_4_x_auto_increment(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.ExpectBegin()
Expand Down Expand Up @@ -370,7 +364,6 @@ func TestFetchRemoteTableModels_4_x_auto_increment(t *testing.T) {
}

func TestFetchRemoteTableModels_4_x_auto_random(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)
defer s.TearDownTest(t)
s.mockDB.ExpectBegin()
Expand Down Expand Up @@ -410,7 +403,6 @@ func TestFetchRemoteTableModels_4_x_auto_random(t *testing.T) {
}

func TestWriteRowsErrorNoRetry(t *testing.T) {
t.Parallel()
nonRetryableError := sql.ErrNoRows
s := createMysqlSuite(t)
defer s.TearDownTest(t)
Expand All @@ -436,7 +428,6 @@ func TestWriteRowsErrorNoRetry(t *testing.T) {
}

func TestWriteRowsErrorDowngradingAll(t *testing.T) {
t.Parallel()
nonRetryableError := sql.ErrNoRows
s := createMysqlSuite(t)
defer s.TearDownTest(t)
Expand Down Expand Up @@ -503,7 +494,6 @@ func TestWriteRowsErrorDowngradingAll(t *testing.T) {
}

func TestWriteRowsErrorDowngradingExceedThreshold(t *testing.T) {
t.Parallel()
nonRetryableError := sql.ErrNoRows
s := createMysqlSuite(t)
defer s.TearDownTest(t)
Expand Down Expand Up @@ -608,7 +598,6 @@ func encodeRowsTiDB(t *testing.T, b backend.Backend, tbl table.Table) kv.Rows {
}

func TestEncodeRowForRecord(t *testing.T) {
t.Parallel()
s := createMysqlSuite(t)

// for a correct row, the will encode a correct result
Expand Down
11 changes: 0 additions & 11 deletions br/pkg/logutil/logging_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func newFile(j int) *backuppb.File {
}

func TestRater(t *testing.T) {
t.Parallel()
m := prometheus.NewCounter(prometheus.CounterOpts{
Namespace: "testing",
Name: "rater",
Expand All @@ -65,13 +64,11 @@ func TestRater(t *testing.T) {
}

func TestFile(t *testing.T) {
t.Parallel()
assertTrimEqual(t, logutil.File(newFile(1)),
`{"file": {"name": "1", "CF": "write", "sha256": "31", "startKey": "31", "endKey": "32", "startVersion": 1, "endVersion": 2, "totalKvs": 1, "totalBytes": 1, "CRC64Xor": 1}}`)
}

func TestFiles(t *testing.T) {
t.Parallel()
cases := []struct {
count int
expect string
Expand All @@ -96,15 +93,13 @@ func TestFiles(t *testing.T) {
}

func TestKey(t *testing.T) {
t.Parallel()
encoder := zapcore.NewConsoleEncoder(zapcore.EncoderConfig{})
out, err := encoder.EncodeEntry(zapcore.Entry{}, []zap.Field{logutil.Key("test", []byte{0, 1, 2, 3})})
require.NoError(t, err)
require.JSONEq(t, `{"test": "00010203"}`, strings.Trim(out.String(), "\n"))
}

func TestKeys(t *testing.T) {
t.Parallel()
cases := []struct {
count int
expect string
Expand All @@ -129,7 +124,6 @@ func TestKeys(t *testing.T) {
}

func TestRewriteRule(t *testing.T) {
t.Parallel()
rule := &import_sstpb.RewriteRule{
OldKeyPrefix: []byte("old"),
NewKeyPrefix: []byte("new"),
Expand All @@ -143,7 +137,6 @@ func TestRewriteRule(t *testing.T) {
}

func TestRegion(t *testing.T) {
t.Parallel()
region := &metapb.Region{
Id: 1,
StartKey: []byte{0x00, 0x01},
Expand All @@ -157,14 +150,12 @@ func TestRegion(t *testing.T) {
}

func TestLeader(t *testing.T) {
t.Parallel()
leader := &metapb.Peer{Id: 2, StoreId: 3}

assertTrimEqual(t, logutil.Leader(leader), `{"leader": "id:2 store_id:3 "}`)
}

func TestSSTMeta(t *testing.T) {
t.Parallel()
meta := &import_sstpb.SSTMeta{
Uuid: []byte("mock uuid"),
Range: &import_sstpb.Range{
Expand All @@ -183,14 +174,12 @@ func TestSSTMeta(t *testing.T) {
}

func TestShortError(t *testing.T) {
t.Parallel()
err := errors.Annotate(berrors.ErrInvalidArgument, "test")

assertTrimEqual(t, logutil.ShortError(err), `{"error": "test: [BR:Common:ErrInvalidArgument]invalid argument"}`)
}

func TestContextual(t *testing.T) {
t.Parallel()
testCore, logs := observer.New(zap.InfoLevel)
logutil.ResetGlobalLogger(zap.New(testCore))

Expand Down
Loading

0 comments on commit 55b20f2

Please sign in to comment.