Skip to content

Commit

Permalink
server, tikv: enable unit test run parallel and add parallel f… (ping…
Browse files Browse the repository at this point in the history
  • Loading branch information
glorv authored and zz-jason committed Jan 9, 2020
1 parent 7988e54 commit 5a9f2fa
Show file tree
Hide file tree
Showing 21 changed files with 416 additions and 299 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ ifeq ("$(TRAVIS_COVERAGE)", "1")
else
@echo "Running in native mode."
@export log_level=error; export TZ='Asia/Shanghai'; \
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) -check.timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
$(GOTEST) -ldflags '$(TEST_LDFLAGS)' -cover $(PACKAGES) -check.p true -check.timeout 4s || { $(FAILPOINT_DISABLE); exit 1; }
endif
@$(FAILPOINT_DISABLE)

Expand Down
3 changes: 2 additions & 1 deletion executor/ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,8 @@ func (s *testSuite6) TestTimestampMinDefaultValue(c *C) {
tk.MustExec("ALTER TABLE tdv ADD COLUMN ts timestamp DEFAULT '1970-01-01 08:00:01';")
}

func (s *testSuiteP1) TestRenameTable(c *C) {
// this test will change the fail-point `mockAutoIDChange`, so we move it to the `testRecoverTable` suite
func (s *testRecoverTable) TestRenameTable(c *C) {
c.Assert(failpoint.Enable("github.com/pingcap/tidb/meta/autoid/mockAutoIDChange", `return(true)`), IsNil)
defer func() {
c.Assert(failpoint.Disable("github.com/pingcap/tidb/meta/autoid/mockAutoIDChange"), IsNil)
Expand Down
6 changes: 3 additions & 3 deletions executor/seqtest/seq_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ func TestT(t *testing.T) {
TestingT(t)
}

var _ = Suite(&seqTestSuite{})
var _ = Suite(&seqTestSuite1{})
var _ = Suite(&testOOMSuite{})
var _ = SerialSuites(&seqTestSuite{})
var _ = SerialSuites(&seqTestSuite1{})
var _ = SerialSuites(&testOOMSuite{})

type seqTestSuite struct {
cluster *mocktikv.Cluster
Expand Down
18 changes: 11 additions & 7 deletions infoschema/tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ import (
"google.golang.org/grpc"
)

var _ = Suite(&testTableSuite{})
var _ = SerialSuites(&testClusterTableSuite{testTableSuite: &testTableSuite{}})
var _ = Suite(&testTableSuite{&testTableSuiteBase{}})
var _ = SerialSuites(&testClusterTableSuite{testTableSuiteBase: &testTableSuiteBase{}})

type testTableSuite struct {
*testTableSuiteBase
}

type testTableSuiteBase struct {
store kv.Storage
dom *domain.Domain
}

func (s *testTableSuite) SetUpSuite(c *C) {
func (s *testTableSuiteBase) SetUpSuite(c *C) {
testleak.BeforeTest()

var err error
Expand All @@ -73,22 +77,22 @@ func (s *testTableSuite) SetUpSuite(c *C) {
c.Assert(err, IsNil)
}

func (s *testTableSuite) TearDownSuite(c *C) {
func (s *testTableSuiteBase) TearDownSuite(c *C) {
s.dom.Close()
s.store.Close()
testleak.AfterTest(c)()
}

type testClusterTableSuite struct {
*testTableSuite
*testTableSuiteBase
rpcserver *grpc.Server
httpServer *httptest.Server
mockAddr string
listenAddr string
}

func (s *testClusterTableSuite) SetUpSuite(c *C) {
s.testTableSuite.SetUpSuite(c)
s.testTableSuiteBase.SetUpSuite(c)
s.rpcserver, s.listenAddr = s.setUpRPCService(c, ":0")
s.httpServer, s.mockAddr = s.setUpMockPDHTTPServer()
}
Expand Down Expand Up @@ -177,7 +181,7 @@ func (s *testClusterTableSuite) TearDownSuite(c *C) {
if s.httpServer != nil {
s.httpServer.Close()
}
s.testTableSuite.TearDownSuite(c)
s.testTableSuiteBase.TearDownSuite(c)
}

func (s *testTableSuite) TestInfoschemaFieldValue(c *C) {
Expand Down
4 changes: 2 additions & 2 deletions server/conn_stmt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/pingcap/tidb/types"
)

func (ts ConnTestSuite) TestParseExecArgs(c *C) {
func (ts *ConnTestSuite) TestParseExecArgs(c *C) {
type args struct {
args []types.Datum
boundParams [][]byte
Expand Down Expand Up @@ -200,7 +200,7 @@ func (ts ConnTestSuite) TestParseExecArgs(c *C) {
}
}

func (ts ConnTestSuite) TestParseStmtFetchCmd(c *C) {
func (ts *ConnTestSuite) TestParseStmtFetchCmd(c *C) {
tests := []struct {
arg []byte
stmtID uint32
Expand Down
Loading

0 comments on commit 5a9f2fa

Please sign in to comment.