First, it fixes goroutine leaks in worker by adding a ctx ub child goroutine to exit if parent is exits. See #1297 for more details.
Second, there were additional goroutine leaks because of initHealthCheck goroutine (watch_connection.go) in SDK. This was because WatchConn was not closed in any of the tests, only Clients were closed. WatchConn.Close() sends closing signal to this goroutine. This is fixed by making helper functions ClosePublisherSubscribers and ClosePublisherSubscribersSDK which close it properly and make is easier for other developers to not worry about it going forward.
Third, none of the tests unsubscribe as part of cleanup. Hence, watch manager keeps sending updates to buffered channel AdhocChannel which has a configured capacity of 20. At some point, it is filled and new watch tests keep on waiting on this channel. This is fixed for GET.WATCH and GET.UNWATCH tests by adding helper functions unsubscribeFromUpdates and unsubscribeFromUpdatesSDK which sets the right cleanup convention for other devs.
This is not fixed for PFCOUNT.WATCH and ZRANGE.WATCH tests as their unwatch functionality is still not implemented. TODO has been added in the respective places.
This PR also makes a few minor changes like acquiring connection in TestMain just before firing ABORT command, migrating testing library to testify/assert, etc.
This PR fixes a bunch of issues.
First, it fixes goroutine leaks in worker by adding a ctx ub child goroutine to exit if parent is exits. See #1297 for more details.
Second, there were additional goroutine leaks because of
initHealthCheck
goroutine (watch_connection.go
) in SDK. This was becauseWatchConn
was not closed in any of the tests, onlyClients
were closed.WatchConn.Close()
sends closing signal to this goroutine. This is fixed by making helper functionsClosePublisherSubscribers
andClosePublisherSubscribersSDK
which close it properly and make is easier for other developers to not worry about it going forward.Third, none of the tests unsubscribe as part of cleanup. Hence, watch manager keeps sending updates to buffered channel
AdhocChannel
which has a configured capacity of 20. At some point, it is filled and new watch tests keep on waiting on this channel. This is fixed for GET.WATCH and GET.UNWATCH tests by adding helper functionsunsubscribeFromUpdates
andunsubscribeFromUpdatesSDK
which sets the right cleanup convention for other devs.This is not fixed for PFCOUNT.WATCH and ZRANGE.WATCH tests as their unwatch functionality is still not implemented. TODO has been added in the respective places.
This PR also makes a few minor changes like acquiring connection in
TestMain
just before firingABORT
command, migrating testing library to testify/assert, etc.Fixes #1297