go-marathon
go-marathon copied to clipboard
Test for goroutine leaks
Add goroutine leak testing to tests to probe for goroutine leakage, as mentioned in https://github.com/gambol99/go-marathon/issues/208
In particular:
=== RUN TestSSEWithManyListeners
--- FAIL: TestSSEWithManyListeners (5.05s)
leaktest.go:129: leaktest: timed out checking goroutines
leaktest.go:147: leaktest: leaked goroutine: goroutine 750 [chan receive]:
github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription.func1(0xc4203a41e0)
/home/travis/gopath/src/github.com/gambol99/go-marathon/subscription.go:186 +0x130
created by github.com/gambol99/go-marathon.(*marathonClient).registerSSESubscription
/home/travis/gopath/src/github.com/gambol99/go-marathon/subscription.go:181 +0x1a6
leaktest.go:147: leaktest: leaked goroutine: goroutine 772 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc4200a09c0, 0xc4202c23a0)
/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:139 +0xee
created by github.com/gambol99/go-marathon.(*cluster).markDown
/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:128 +0x186
leaktest.go:147: leaktest: leaked goroutine: goroutine 774 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc4200a09c0, 0xc4202c23c0)
/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:139 +0xee
created by github.com/gambol99/go-marathon.(*cluster).markDown
/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:128 +0x186
leaktest.go:147: leaktest: leaked goroutine: goroutine 777 [chan receive]:
github.com/gambol99/go-marathon.(*cluster).healthCheckNode(0xc4200a09c0, 0xc4202c23e0)
/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:139 +0xee
created by github.com/gambol99/go-marathon.(*cluster).markDown
/home/travis/gopath/src/github.com/gambol99/go-marathon/cluster.go:128 +0x186
illustrates that the number of goroutines will increase if the listeners are not doing their job of consuming events and don't deregister.
Cc: @seanisom, @mayanand, @kmillett
CC: @timoreimann @gambol99 @sybrandy @iandyh @marco-jantke
LGTM.