Skip to content

Commit

Permalink
Fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
yux0 committed Dec 18, 2019
1 parent 252a76b commit 51b2b2e
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions test/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,29 @@ func (ts *IntegrationTestSuite) SetupSuite() {

func (ts *IntegrationTestSuite) TearDownSuite() {
ts.rpcClient.Close()
// sleep for a while to allow the pollers to shutdown
// then assert that there are no lingering go routines
time.Sleep(1 * time.Minute)
// https://github.com/uber-go/cadence-client/issues/739
goleak.VerifyNoLeaks(ts.T(), goleak.IgnoreTopFunction("go.uber.org/cadence/internal.(*coroutineState).initialYield"))

// allow the pollers to shut down, and ensure there are no goroutine leaks.
// this will wait for up to 1 minute for leaks to subside, but exit relatively quickly if possible.
max := time.After(time.Minute)
var last error
for {
select {
case <-max:
if last != nil {
ts.NoError(last)
return
}
ts.FailNow("leaks timed out but no error, should be impossible")
case <-time.After(time.Second):
// https://github.com/uber-go/cadence-client/issues/739
last = goleak.FindLeaks(goleak.IgnoreTopFunction("go.uber.org/cadence/internal.(*coroutineState).initialYield"))
if last == nil {
// no leak, done waiting
return
}
// else wait for another check or the timeout (which will record the latest error)
}
}
}

func (ts *IntegrationTestSuite) SetupTest() {
Expand Down

0 comments on commit 51b2b2e

Please sign in to comment.