Skip to content

Commit

Permalink
session: tiny update leak check for some test function (pingcap#6526)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao authored May 11, 2018
1 parent 91d90e6 commit 3a76adf
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions session/tidb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package session
import (
"fmt"
"os"
"runtime"
"sync"
"sync/atomic"
"testing"
Expand Down Expand Up @@ -140,8 +139,6 @@ func (s *testMainSuite) TestRetryDialPumpClient(c *C) {
}

func (s *testMainSuite) TestSysSessionPoolGoroutineLeak(c *C) {
c.Skip("make leak should check it")
// TODO: testleak package should be able to find this leak.
store, dom := newStoreWithBootstrap(c, s.dbName+"goroutine_leak")
defer dom.Close()
defer store.Close()
Expand All @@ -150,7 +147,6 @@ func (s *testMainSuite) TestSysSessionPoolGoroutineLeak(c *C) {

// Test an issue that sysSessionPool doesn't call session's Close, cause
// asyncGetTSWorker goroutine leak.
before := runtime.NumGoroutine()
count := 200
var wg sync.WaitGroup
wg.Add(count)
Expand All @@ -164,21 +160,9 @@ func (s *testMainSuite) TestSysSessionPoolGoroutineLeak(c *C) {
wg.Wait()
se.sysSessionPool().Close()
c.Assert(se.sysSessionPool().IsClosed(), Equals, true)
for i := 0; i < 300; i++ {
// After and before should be Equal, but this test may be disturbed by other factors.
// So I relax the strict check to make CI more stable.
after := runtime.NumGoroutine()
if after-before < 3 {
return
}
time.Sleep(20 * time.Millisecond)
}
after := runtime.NumGoroutine()
c.Assert(after-before, Less, 3)
}

func (s *testMainSuite) TestSchemaCheckerSimple(c *C) {
defer testleak.AfterTest(c)()
lease := 5 * time.Millisecond
validator := domain.NewSchemaValidator(lease)
checker := &schemaLeaseChecker{SchemaValidator: validator}
Expand Down

0 comments on commit 3a76adf

Please sign in to comment.