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

[close #128] Fix TestClientErrNoPendingRegion #127

Merged
merged 3 commits into from
Jun 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cdc/cdc/kv/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type clientSuite struct {
e *embed.Etcd
}

var _ = check.Suite(&clientSuite{})
var _ = check.SerialSuites(&clientSuite{}) // should be serial, as some test cases depend on global variable `currentRequestID()`

func (s *clientSuite) SetUpTest(c *check.C) {
dir := c.MkDir()
Expand Down Expand Up @@ -2891,14 +2891,14 @@ func (s *clientSuite) testClientErrNoPendingRegion(c *check.C) {
defer regionCache.Close()
cdcClient := NewCDCClient(ctx, pdClient, kvStorage, grpcPool, regionCache)
eventCh := make(chan model.RegionFeedEvent, 10)
baseAllocatedID := currentRequestID() // should get `currentRequestID()` before goroutine for `cdcClient.EventFeed`
wg.Add(1)
go func() {
defer wg.Done()
err := cdcClient.EventFeed(ctx, regionspan.ComparableSpan{Start: []byte("a"), End: []byte("c")}, 100, false, lockresolver, isPullInit, eventCh)
c.Assert(errors.Cause(err), check.Equals, context.Canceled)
}()

baseAllocatedID := currentRequestID()
// wait the second region is scheduled
time.Sleep(time.Millisecond * 500)
waitRequestID(c, baseAllocatedID+1)
Expand Down