Use t.Cleanup for startWorkhorseServerWithConfig startWorkhorseServer
What does this MR do and why?
Replace cleanup with t.Cleanup in workhorse tests.
In many places we return a cleanup function and defer its execution in order to cleanup after tests. This MR refactors it to use T.Cleanup as it has been added to Go.
Checks
-
(startWorkhorseServerWithConfig, startWorkhorseServer) -- main_test.go -- these two functions can accept *testing.T and internally cleanup: it will save us from calling defer ws.Close() everytime
-
(startWebsocketServer) -- channel_test.go -- this function can accept *testing.T and internally cleanup: it will save us from calling defer ws.Close() everytime
-
(wireupChannel) -- channel_test.go -- contains calls to testAuthServer, startWorkhorseServer, startWebsocketServer: when these functions are refactored, wireupChannel don't need to explicitly cleanup anything
Checkboxes of #433440 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
How to set up and validate locally
Passing workhorse tests should be sufficient.
Pulled from Replace cleanup with t.Cleanup in workhorse tests (!141855 - closed) to reduce MR size.
Related to #433440 (closed)