Skip to content

Commit aaa4001

Browse files
authored
Merge branch 'release-3.0' into release-3.0
2 parents d877913 + 4cbe840 commit aaa4001

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

store/tikv/client_fail_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,24 @@ import (
2525
"github.com/pingcap/tidb/store/tikv/tikvrpc"
2626
)
2727

28+
type testClientFailSuite struct {
29+
OneByOneSuite
30+
}
31+
32+
func (s *testClientFailSuite) SetUpSuite(c *C) {
33+
// This lock make testClientFailSuite runs exclusively.
34+
withTiKVGlobalLock.Lock()
35+
}
36+
37+
func (s testClientFailSuite) TearDownSuite(c *C) {
38+
withTiKVGlobalLock.Unlock()
39+
}
40+
2841
func setGrpcConnectionCount(count uint) {
2942
config.GetGlobalConfig().TiKVClient.GrpcConnectionCount = count
3043
}
3144

32-
func (s *testClientSuite) TestPanicInRecvLoop(c *C) {
45+
func (s *testClientFailSuite) TestPanicInRecvLoop(c *C) {
3346
c.Assert(failpoint.Enable("github.com/pingcap/tidb/store/tikv/panicInFailPendingRequests", `panic`), IsNil)
3447
c.Assert(failpoint.Enable("github.com/pingcap/tidb/store/tikv/gotErrorInRecvLoop", `return("0")`), IsNil)
3548

store/tikv/client_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type testClientSuite struct {
3636
}
3737

3838
var _ = Suite(&testClientSuite{})
39+
var _ = Suite(&testClientFailSuite{})
3940

4041
func setMaxBatchSize(size uint) {
4142
config.GetGlobalConfig().TiKVClient.MaxBatchSize = size

store/tikv/ticlient_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import (
2828
)
2929

3030
var (
31-
withTiKVGlobalLock sync.Mutex
31+
withTiKVGlobalLock sync.RWMutex
3232
withTiKV = flag.Bool("with-tikv", false, "run tests with TiKV cluster started. (not use the mock server)")
3333
pdAddrs = flag.String("pd-addrs", "127.0.0.1:2379", "pd addrs")
3434
)

store/tikv/tikv_test.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,21 @@ import (
1818
)
1919

2020
// OneByOneSuite is a suite, When with-tikv flag is true, there is only one storage, so the test suite have to run one by one.
21-
type OneByOneSuite struct {
22-
}
21+
type OneByOneSuite struct{}
2322

24-
func (s OneByOneSuite) SetUpSuite(c *C) {
23+
func (s *OneByOneSuite) SetUpSuite(c *C) {
2524
if *withTiKV {
2625
withTiKVGlobalLock.Lock()
26+
} else {
27+
withTiKVGlobalLock.RLock()
2728
}
2829
}
2930

30-
func (s OneByOneSuite) TearDownSuite(c *C) {
31+
func (s *OneByOneSuite) TearDownSuite(c *C) {
3132
if *withTiKV {
3233
withTiKVGlobalLock.Unlock()
34+
} else {
35+
withTiKVGlobalLock.RUnlock()
3336
}
3437
}
3538

0 commit comments

Comments
 (0)