Skip to content

Commit

Permalink
test: fix TestStreamSendWithError unstable test (#2568) (#2589)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Aug 20, 2021
1 parent e90a108 commit f3fdd65
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions cdc/kv/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ loop:
if e == nil {
break loop
}
err := server.Send(e)
s.c.Assert(err, check.IsNil)
_ = server.Send(e)
case <-notify.notify:
break loop
}
Expand Down Expand Up @@ -1198,7 +1197,7 @@ func (s *etcdSuite) TestStreamSendWithError(c *check.C) {
cluster.Bootstrap(regionID3, []uint64{1}, []uint64{4}, 4)
cluster.SplitRaw(regionID3, regionID4, []byte("b"), []uint64{5}, 5)

lockresolver := txnutil.NewLockerResolver(kvStorage)
lockerResolver := txnutil.NewLockerResolver(kvStorage)
isPullInit := &mockPullerInit{}
grpcPool := NewGrpcPoolImpl(ctx, &security.Credential{})
defer grpcPool.Close()
Expand All @@ -1207,7 +1206,7 @@ func (s *etcdSuite) TestStreamSendWithError(c *check.C) {
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)
err := cdcClient.EventFeed(ctx, regionspan.ComparableSpan{Start: []byte("a"), End: []byte("c")}, 100, false, lockerResolver, isPullInit, eventCh)
c.Assert(errors.Cause(err), check.Equals, context.Canceled)
cdcClient.Close() //nolint:errcheck
}()
Expand Down Expand Up @@ -1269,12 +1268,10 @@ func (s *etcdSuite) TestStreamSendWithError(c *check.C) {

// a hack way to check the goroutine count of region worker is 1
buf := make([]byte, 1<<20)
stacklen := runtime.Stack(buf, true)
stack := string(buf[:stacklen])
stackLen := runtime.Stack(buf, true)
stack := string(buf[:stackLen])
c.Assert(strings.Count(stack, "resolveLock"), check.Equals, 1)
c.Assert(strings.Count(stack, "collectWorkpoolError"), check.Equals, 1)

cancel()
}

func (s *etcdSuite) testStreamRecvWithError(c *check.C, failpointStr string) {
Expand Down

0 comments on commit f3fdd65

Please sign in to comment.